http访问返回异常

wanj2015 2017-05-05 05:30:01
思路:我用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:
...全文
526 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
屎克螂 2017-05-08
  • 打赏
  • 举报
回复
你应该贴代码
wanj2015 2017-05-06
  • 打赏
  • 举报
回复
请大神过来看看看
wanj2015 2017-05-05
  • 打赏
  • 举报
回复
没人知道吗,自己顶一下

37,743

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • WuKongSecurity@BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧