Skip to content Skip to sidebar Skip to footer

How To Download Files In Python With Post Request?

I am trying to download an export from an app automatically with python. Here is my code: export_url = 'https://....' payload = {'key1': 'value1', 'key2': 'value2', 'key3': 'value3

Solution 1:

Perhaps you should take a look at the documentation.

When you print r, you get the status code. (Well, not exactly, but the printed number is the status code.)

What you probably want to use is r.text:

text

Content of the response, in unicode.

If Response.encoding is None, encoding will be guessed using chardet.

The encoding of the response content is determined based solely on HTTP headers, following RFC 2616 to the letter. If you can take advantage of non-HTTP knowledge to make a better guess at the encoding, you should set r.encoding appropriately before accessing this property.

Or r.content:

content

Content of the response, in bytes.

Post a Comment for "How To Download Files In Python With Post Request?"