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"}
Read More:
- [Solved] Python requests ConnectionError Error: connection aborted BadStatusLine
- When sending HTTP request, python encountered: error 54, ‘connection reset by peer’ solution
- Failed to establish a new connection: [winerror 10048] in the requests thread pool, the interface is called circularly to get the datagram error
- Python Error: Failed to establish a new connection: [Errno -2] Name or service not known
- Linux create connection command ln -s soft connection
- [Solved] socketio.exceptions.ConnectionError: OPEN packet not returned by server
- Python + Requests +Excel+Jenkins interface automation
- Python Requests Error: Max retries exceeded with url
- visdom Install and Run Error: raise Connectionerror [How to Solve]
- [Solved] Python Requests Error: simplejson.errors.JSONDecodeError: Expecting value
- [Solved] ValueError: Connection error, and we cannot find the requested files in the cached path…
- Here is the difference and connection of Torch. View (), Transpose (), and Permute ()
- [Solved] Connection Error: couldn‘t reach http://raw.githubusercontent.com/huggingface/…
- [Solved] USB: usb_device_handle_win.cc:1049 Failed to read descriptor from node connection…
- ModuleNotFoundError: No module named ‘requests‘ [How to Solve]
- [Solved] ModuleNotFoundError: No module named ‘requests‘
- [Solved] Forbidden (403) CSRF verification failed. Request aborted.
- Python: RNN principle realized by numpy
- [Solved] Pychar error: modulenotfounderror: no module named ‘requests_ HTML ‘solution
- Pycharm WebSocket Error: Error: Connection error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed