Skip to content Skip to sidebar Skip to footer

How To Solve The 10054 Error

I'm using an app provided by some website to collect some data from the website periodly, say, 30s a time. The returned response is then recorded in database. I use the requests mo

Solution 1:

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.

Solution 2:

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)

Post a Comment for "How To Solve The 10054 Error"