我正在尝试将附件上载到azuredevops,但文件已损坏,不确定原因
attachment_file = BytesIO(requests.get('http://127.0.0.1:8000'+attachment.attachment.url).content)
files = {"file": (attachment.attachment_name,attachment_file)}
response_attachment =requests.post(attachment_url,files=files,headers={'Accept': 'application/json',"Content-Type": "application/octet-stream",},auth=HTTPBasicAuth(azure_username,azure_token))
请尝试使用附件文件
.read()
将BytesIO
对象转换为可读格式 尝试下面的代码,它可以帮助您查看此处以了解更多信息info
相关问题 更多 >
编程相关推荐