http访问返回异常
思路:我用python连接微信端实现微信机器人。运行了一段时间比较稳定,但是这两天总是时不时的抛异常,严重时经常掉线
微信那边正常返回的信息:HTTP/1.1 200 OK 但是有时返回:HTTP/1.1 0 - 返回码不是200而是0.这个0是代表什么意思?
具体错误信息:
Traceback (most recent call last):
File "D:\Python\Python36-32\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 600, in urlopen
chunked=chunked)
File "D:\Python\Python36-32\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 386, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "D:\Python\Python36-32\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 382, in _make_request
httplib_response = conn.getresponse()
File "D:\Python\Python36-32\lib\http\client.py", line 1331, in getresponse
response.begin()
File "D:\Python\Python36-32\lib\http\client.py", line 297, in begin
version, status, reason = self._read_status()
File "D:\Python\Python36-32\lib\http\client.py", line 285, in _read_status
raise BadStatusLine(line)
http.client.BadStatusLine: HTTP/1.1 0 -
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Python\Python36-32\lib\site-packages\requests\adapters.py", line 423, in send
timeout=timeout
File "D:\Python\Python36-32\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 649, in urlopen
_stacktrace=sys.exc_info()[2])
File "D:\Python\Python36-32\lib\site-packages\requests\packages\urllib3\util\retry.py", line 347, in increment
raise six.reraise(type(error), error, _stacktrace)
File "D:\Python\Python36-32\lib\site-packages\requests\packages\urllib3\packages\six.py", line 685, in reraise
raise value.with_traceback(tb)
File "D:\Python\Python36-32\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 600, in urlopen
chunked=chunked)
File "D:\Python\Python36-32\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 386, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "D:\Python\Python36-32\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 382, in _make_request
httplib_response = conn.getresponse()
File "D:\Python\Python36-32\lib\http\client.py", line 1331, in getresponse
response.begin()
File "D:\Python\Python36-32\lib\http\client.py", line 297, in begin
version, status, reason = self._read_status()
File "D:\Python\Python36-32\lib\http\client.py", line 285, in _read_status
raise BadStatusLine(line)
requests.packages.urllib3.exceptions.ProtocolError: ('Connection aborted.', BadStatusLine('HTTP/1.1 0 -\r\n',))
During handling of the above exception, another exception occurred: