报错信息:
raise ConnectionError(err, request=request) requests.exceptions.ConnectionError: ('Connection aborted.', BadStatusLine("''", ))
涉及代码
data = {"host":host,"key":key,"value":value,"dns":ip}
res = requests.post(url=url,json = data)
方法1: 加重试
requests.adapters.DEFAULT_RETRIES = 5
方法2:加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)
方法3: curl
1,2 都不行,curl命令,发现报错:
? Empty reply from server
答案: You get this error when your Python client receives an empty response (header /body).
python - Connection aborted.', BadStatusLine("''",) on server? - Stack Overflow
|