当在记事本上查看时,对非api源的请求给了我编码错误的数据文件++

2024-04-26 01:32:32 发布

您现在位置:Python中文网/ 问答频道 /正文

enter image description here

当我向非api源中请求时,存储到blob存储中的解析文件在notepad++的后端有错误的编码—但是前端没有问题。你知道吗

我想纠正后端问题,因为它是混乱我的ELT/ETL上的数据工厂,因为文件的后端是不让数据工厂读取数据正确。你知道吗

除非有其他方法来缓解数据工厂的这个问题,否则我洗耳恭听。你知道吗

请求最后一部分的代码:

download = s.post(url=post_report_url,headers=download_headers,data=after_post_xml,stream=True)
print("getting data")
print(download)

soup = BeautifulSoup(download.text,"html.parser")
get_text = soup.get_text()
document_bytes = soup.find('a:documentbytes').get_text()
data = base64.b64decode(document_bytes)

with BytesIO(data) as input_blob:
    print("connecting to blob storage")
    blob_service = BlockBlobService(account_name="asd",account_key='asd+sdads==')
    blob_service.create_blob_from_stream('asd-blob',blob_name='asd/asd.asd',stream=input_blob)
    generator = blob_service.list_blobs('asd-blob')
    for blob in generator:
        print("\t Blob name: " + blob.name)

Tags: 文件数据textnamedatastreamgetdownload