python requests http response 500 (site can be reached in browser)

后端 未结 3 1890
长情又很酷
长情又很酷 2021-01-02 10:36

I am trying to figure out what I\'m doing wrong here, but I keep getting lost...

In python 2.7, I\'m running following code:

>>> import requ         


        
3条回答
  •  悲&欢浪女
    2021-01-02 10:59

    The User-Agent, and also other header elements, could be causing your problem.

    When I came accross this error I watched a regular request made by a browser using Wireshark, and it turned out there were things other than just the User-Agent in the header which the server expected to be there.

    After emulating the header sent by the browser in python requests, the server stopped throwing errors.

提交回复
热议问题