Я пытаюсь использовать метод Requests lib post для загрузки pdf в http://www.pdfonline.com/convert-pdf-to-html/, но получаю 406 ошибку:
url_gem = 'http://www2.hkexnews.hk/-/media/HKEXnews/Homepage/New-Listings/New-Listing-Information/New-Listing-Report/GEM/e_newlistings.pdf'
response_down = requests.get(url_gem)
with open('GEM.pdf', 'wb+') as f:
f.write(response_down.content)
converter_url = 'http://207.135.71.158:8080/upload'
file = {'file': open('GEM.pdf', 'rb')}
headers = {'Accept': "application/pdf,.pdf", 'Content-Type':"multipart/form-data",
'Cache-Control': "no-cache", 'User-Agent': 'Mozilla/5.0 (X11; '
'Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) '
'Chrome/54.0.2840.90 Safari/537.36'}
response = requests.post(converter_url, files = file, headers = headers)
print(response)
print(response.status_code)
print(response.headers)
Сообщение об ошибке:
<Response [406]>
406
{'Content-Length': '0', 'Date': 'Thu, 13 Dec 2018 06:03:25 GMT'}
Process finished with exit code 0
Любая помощь будет оценена.