如何在 header 中为请求指定有效 content-range:Method-Put
How to specify valid content-range in header for request: Method-Put
我正在请求上传 doc 文件,使用方法:PUT 和以下配置:
#Upload file (Testfile.doc) size is 11kb.
with open(Testfile.doc, "rb") as f:
Test_file=f.read()
url = organization_url+attachment_ID+apiversion # when i hit this url in browser, i see the attachment doc file to get download.
Header = {"Content-Type":"application/octet-stream","Content-Range":"bytes 0-11100/*"}
Initiate_Request = requests.put(url=url,header=Header,data=Test_file,auth=('',PAT))
print("Attachment_details:-",Initiate_Request.text) ## {"count":1,"value":{"Message":"Content-Range specified in the attachment upload request is not valid."}}
print("Attachment_details_Status_Code:-",Initiate_Request.status_code) ## <Response [400]>
关于如何为上述请求指定有效 content-range 的任何建议。
这解决了我的目的:
{"Content-Type":"application/octet-stream","Content-Length":"11100","Content-Range":"bytes 0-11099/11100"}
我正在请求上传 doc 文件,使用方法:PUT 和以下配置:
#Upload file (Testfile.doc) size is 11kb.
with open(Testfile.doc, "rb") as f:
Test_file=f.read()
url = organization_url+attachment_ID+apiversion # when i hit this url in browser, i see the attachment doc file to get download.
Header = {"Content-Type":"application/octet-stream","Content-Range":"bytes 0-11100/*"}
Initiate_Request = requests.put(url=url,header=Header,data=Test_file,auth=('',PAT))
print("Attachment_details:-",Initiate_Request.text) ## {"count":1,"value":{"Message":"Content-Range specified in the attachment upload request is not valid."}}
print("Attachment_details_Status_Code:-",Initiate_Request.status_code) ## <Response [400]>
关于如何为上述请求指定有效 content-range 的任何建议。
这解决了我的目的:
{"Content-Type":"application/octet-stream","Content-Length":"11100","Content-Range":"bytes 0-11099/11100"}