“Bad Gateway” error using Python requests module with multipart encoded file POST
“Bad Gateway” error using Python requests module with multipart encoded file POST I am getting the error message "Bad Gateway The proxy server received an invalid response from an upstream server" with the following code: import requests url = "https://apis.company.com/v3/media" attachments = 'media': ('x.mp3', open('x.mp3', 'r'))} headers = {'content-type': "multipart/form-data",'cache-control': "no-cache" 'Authorization':"Bearer zzz" } response = requests.post(url, files=attachments, headers = headers) print response.text I'm following the example in the requests Quickstart documentation, where it says "You can also pass a list of tuples to the data argument": http://docs.python-requests.org/en/master/user/quickstart/#post-a-multipart-encoded-file What is causing this error and how can I fix it? @Goyo if I change "files...