Python requests error
ConnectionError: (‘Connection aborted.’, error(104, ‘Connection reset by peer’))
There are two possible causes
1. Requests are too frequent, resulting in requests being rejected
Solution:
Set a sleep time for each request, such as
time sleep(1)
2. The interface has authentication or anti crawling mechanism. It is recognized that it is accessed by Python terminal, and the access is rejected
Solution:
Set user agent in request header to bypass authentication
as
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko',"Content-Type": "application/json"}