Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python requests, PUT empty data [duplicate]

I am trying to use request to PUT some data as such,

r = requests.put(
        url,
        data={'tiles': []},
        headers={'x-auth-token': token}
    )

However, tiles is not sent if it is just an empty list. tiles only appears when the data is not empty. I checked this with http://httpbin.org/put also.

Does anyone have any ideas how to put empty data?

like image 243
Shatnerz Avatar asked Mar 06 '26 23:03

Shatnerz


1 Answers

Naturally I figured it out immediately after asking. I wanted to use json inplace of data.

r = requests.put(
        url,
        json={'tiles': []},
        headers={'x-auth-token': token}
    )
like image 106
Shatnerz Avatar answered Mar 08 '26 12:03

Shatnerz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!