Error Messages:
raise ConnectionError(err, request=request) requests.exceptions.ConnectionError: (‘Connection aborted.’, BadStatusLine(“””, ))
Codes
data = {"host":host,"key":key,"value":value,"dns":ip}
res = requests.post(url=url,json = data)
Method 1: add retry
requests.adapters.DEFAULT_RETRIES = 5
Method 2: add header
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.0; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0'}
res = requests.post(url=url,json = data,headers=headers)
Method 3: curl
If method 1,2 does not work, use curl command to find the following error messages:
Empty reply from server
Solution: https://stackoverflow.com/questions/48814200/connection-aborted-badstatusline-on-server
Read More:
- Python requests Error: ConnectionError: (‘Connection aborted.‘, error(104, ‘Connection reset by peer‘))
- Python Error: Failed to establish a new connection: [Errno -2] Name or service not known
- Failed to establish a new connection: [winerror 10048] in the requests thread pool, the interface is called circularly to get the datagram error
- When sending HTTP request, python encountered: error 54, ‘connection reset by peer’ solution
- visdom Install and Run Error: raise Connectionerror [How to Solve]
- Python + Requests +Excel+Jenkins interface automation
- Robotframework post error“:“Internal Server Error“,“message“:“syntax error, expect
- urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host=‘localhost‘, port=8097): Max retries excee
- [Solved] Python serializate error: NameError: name ‘JSON’ is not defined
- Python Requests Error: Max retries exceeded with url
- urllib.error.HTTPError: HTTP Error 403: Forbidden [How to Solve]
- Crawler overtime error socket.timeout: timed out/NameError: name ‘socket‘ is not defined
- The automatic token of Python interface is passed into the header
- Python: How to Disable InsecureRequestWarning error
- How to Fix “HTTP error 403: forbidden” in Python 3. X
- _ssl.c:510: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
- Python parsing JSON Error: NameError: name ‘false’ is not defined
- urllib.error.HTTPError http error 403 forbidden
- Decode PUP data Error when reading radar data [How to Solve]