close

[Solved] requests.exceptions.ConnectionError: (‘Connection aborted.’, ConnectionResetError(104, ‘Connection reset by peer’))

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error requests.exceptions.ConnectionError: (‘Connection aborted.’, ConnectionResetError(104, ‘Connection reset by peer’)) in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How requests.exceptions.ConnectionError: (‘Connection aborted.’, ConnectionResetError(104, ‘Connection reset by peer’)) Error Occurs?

Today I get the following error requests.exceptions.ConnectionError: (‘Connection aborted.’, ConnectionResetError(104, ‘Connection reset by peer’)) in python.

How To Solve requests.exceptions.ConnectionError: (‘Connection aborted.’, ConnectionResetError(104, ‘Connection reset by peer’)) Error ?

  1. How To Solve requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')) Error ?

    To Solve requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')) Error you might already figured this out. Any way, I had a similar problem while making post requests in a for loop, which run 400 times, each loop run with two requests and a last request after exiting the loop.

  2. requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

    To Solve requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')) Error you might already figured this out. Any way, I had a similar problem while making post requests in a for loop, which run 400 times, each loop run with two requests and a last request after exiting the loop.

Solution 1

you might already figured this out. Any way, I had a similar problem while making post requests in a for loop, which run 400 times, each loop run with two requests and a last request after exiting the loop. I found out while making API requests the server (check_mk) was not ready, still compiling some hots and service data. So I placed the time.sleep() just before the each request and that fixed the problem. I don’t know how often you make the requests but I’d try it this way:

def getdata3(...)
    datarALL = []
    time.sleep(0.01)
    responsedata = requests.get(url, data=data, headers=hed, verify=False)
    if responsedata.status_code == 200:  # 200 for successful call
        responsedata = responsedata.text
        jsondata = json.loads(responsedata)
        if "results" in jsondata:
            if jsondata["results"]:
                datarALL.extend(jsondata["results"])
    print ("{1} page {0} finished".format(page,str(datetime.now())))
    return datarALL

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read