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 = "http://13.166.3.129/"
username = 'dfhsdjfhs@gmail.com'
password = 'fsfsgsd'
login = session.post(url, data={'cmd':'login','usr':username, 'pwd':password})

#check if status code is 200
print login.status_code

new_url = "http://13.166.3.129/api/method/lead.form_api.update_form"

data = {
    "id": 196067,
    }

response = session.post(new_url, params=data)
print(response.text)

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.