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:
...全文
265 点赞 收藏 3
写回复
3 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
屎克螂 2017-05-08
你应该贴代码
回复
wanj2015 2017-05-06
请大神过来看看看
回复
wanj2015 2017-05-05
没人知道吗,自己顶一下
回复
相关推荐
发帖
脚本语言
创建于2007-08-27

3.7w+

社区成员

JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
申请成为版主
帖子事件
创建了帖子
2017-05-05 05:30
社区公告

CSDN 脚本语言社区接受专栏投稿(专栏会在顶部创建专属你的栏目),投稿需满足以下要求:

  • 脚本语言技术相关;
  • 文章持续更新,保持活跃;
  • 内容清晰明了,干货为主;
  • 文章排版有序,有条有理。

本社区开通招聘专栏,发布招聘信息请联系版主,发布者需要保证招聘信息真实有效,CSDN 平台和版主不对招聘内容负责!

联系方式:私聊版主、发送邮件、QQ联系等均可: