How to download files in python with post request?

前端 未结 1 1232
萌比男神i
萌比男神i 2021-01-21 09:26

I am trying to download an export from an app automatically with python. Here is my code:

export_url = \'https://....\'
payload = {\'key1\': \'value1\', \'key2\'         


        
1条回答
  •  感情败类
    2021-01-21 10:10

    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.

    0 讨论(0)
提交回复
热议问题