Frappe api endpoint returns requests.exceptions.ConnectionError: ('Connection aborted.', BadStatusLine("''",)) when consecutive 7 api calls to the same api end point

I have an api end point in frappe which i access after the login call. The api calls work fine initially but fails with an error requests.exceptions.ConnectionError: (‘Connection aborted.’, BadStatusLine(“‘’”,))
when I consecutively, in quick succession try accessing it for the 7th time. Then my ip gets blocked for a short period of time during which i cannot access the ip even through the browser. but say with another network im still able to access.

The api script im trying to use is.

import sys
import requests
import hashlib

session = requests.Session()
url = ""
username = ''
password = 'fsfsgsd'
login =, data={'cmd':'login','usr':username, 'pwd':password})

#check if status code is 200
print login.status_code

new_url = ""

data = {
    "id": 196067,

response =, params=data)

I checked the nginx access logs but there is nothing out there. Is there any other settting changes i need to setup, to make sure that this doesnt happen? Checked in the security setting too…increasing the simultaneous session …dint help.

1 Like

+1 I am able to reproduce this.

closed. This was fail2ban issue.