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:
微信那边正常返回的信息: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:
...全文
相关推荐
批量访问网站并返回访问结果
总之,批量访问网站并返回访问结果涉及的知识点广泛,包括网络编程、网页解析、多线程/异步处理、异常处理、数据存储、自动化测试等多个方面。
Http请求模拟报文返回工具
Tomcat作为一个流行的Java Web容器,可以承载这样的模拟工具,使得它可以通过网络访问。2. 配置:在工具内部,用户可以设定不同的HTTP响应规则,包括但不限于状态码、响应头、响应体等。
易语言源代码_HTTP访问.zip
**错误处理与异常捕获**:在HTTP访问过程中,可能会遇到网络中断、服务器错误等各种问题,易语言源代码应包含适当的错误处理机制,如使用异常处理结构来捕获和处理这些问题。5.
易语言HTTP访问.rar
易语言提供了异常处理机制,开发者需要编写代码来捕获并处理这些异常,保证程序的健壮性。5. **HTTP响应处理**:当服务器接收到请求后,会返回一个HTTP响应,包含状态码、头部信息和响应体。
java发起http请求获取返回的Json对象方法
**处理异常**: 在发起HTTP请求的过程中,可能会遇到各种异常,比如网络问题或数据问题。在代码中使用了try-catch语句来捕获并处理这些异常。


