Skip to content

Tag: python-requests

Saving a byte stream PDF as file in python

via requests I receive the following PDF document, that I want to save: I tried saving it via: which works, but the pdf is corrupt. How do I save this PDF? Answer It seems like base64-encoded (described in RFC 3548) data inside JSON, try following: As side note: you do not need to close file explicitly if you…

Can’t convert curl to python request

I copied request as CURL with help of dev-tools and received: Copied request to console (curl works fine). Received result Converted curl to python requests with help of https://curl.trillworks.com/ Received: Tried this code and received error Body is not valid Latin-1. Use body.encode(‘utf-8’) if…

how to post xml in python

i am trying to post string as xml, here is the code: response from server: i also tried code like this: response from server: Answer HTTP 415 is Unsupported Media Type – this suggest your request is missing or has incorrect Content-Type header. Try: