How to solve the 10054 error How to solve the 10054 error python python

How to solve the 10054 error


The web server actively rejected your connection. That's usually because it is congested, has rate limiting or thinks that you are launching a denial of service attack. If you get this from a server, you should sleep a bit before trying again. In fact, if you don't sleep before retry, you are a denial of service attack. The polite thing to do is implement a progressive sleep of, say, (1,2,4,8,16,32) seconds.


You can try it. It solved my problem with ConnectionResetError 10054.

session = requests.Session()session.headers = {    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.1.2222.33 Safari/537.36",    "Accept-Encoding": "*",    "Connection": "keep-alive"}response = session.get(self.request_url)