python urllib/urllib2/httplib/httplib2

本文详细对比了Python中处理HTTP请求的几个主要库:urllib、urllib2、httplib及httplib2的区别,并提供了httplib2的具体使用方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

调用接口时报错[ERROR] [1741755041.455703, 382.900000]: Error processing request: HTTPConnectionPool(host='127.0.0.1', port=1936): Read timed out. (read timeout=180) ['Traceback (most recent call last):\n', ' File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 387, in _make_request\n six.raise_from(e, None)\n', ' File "<string>", line 3, in raise_from\n', ' File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 383, in _make_request\n httplib_response = conn.getresponse()\n', ' File "/usr/lib/python3.6/http/client.py", line 1377, in getresponse\n response.begin()\n', ' File "/usr/lib/python3.6/http/client.py", line 320, in begin\n version, status, reason = self._read_status()\n', ' File "/usr/lib/python3.6/http/client.py", line 281, in _read_status\n line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")\n', ' File "/usr/lib/python3.6/socket.py", line 586, in readinto\n return self._sock.recv_into(b)\n', 'socket.timeout: timed out\n', '\nDuring handling of the above exception, another exception occurred:\n\n', 'Traceback (most recent call last):\n', ' File "/usr/lib/python3/dist-packages/requests/adapters.py", line 440, in send\n timeout=timeout\n', ' File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 639, in urlopen\n _stacktrace=sys.exc_info()[2])\n', ' File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 367, in increment\n raise six.reraise(type(error), error, _stacktrace)\n', ' File "/home/robot/.local/lib/python3.6/site-packages/six.py", line 719, in reraise\n raise value\n', ' File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 601, in urlopen\n chunked=chunked)\n', ' File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 389, in _make_request\n self._raise_timeout(err=e, url=url, timeout_value=read_timeout)\n', ' File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 309, in _raise_timeout\n raise Rea
03-13
[root@lck my_wordpress]# docker-compose up -d /usr/local/lib/python3.6/site-packages/paramiko/transport.py:32: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography. The next release of cryptography will remove support for Python 3.6. from cryptography.hazmat.backends import default_backend Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 723, in urlopen chunked=chunked, File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 416, in _make_request conn.request(method, url, **httplib_request_kw) File "/usr/lib64/python3.6/http/client.py", line 1254, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/lib64/python3.6/http/client.py", line 1300, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/usr/lib64/python3.6/http/client.py", line 1249, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/lib64/python3.6/http/client.py", line 1036, in _send_output self.send(msg) File "/usr/lib64/python3.6/http/client.py", line 974, in send self.connect() File "/usr/local/lib/python3.6/site-packages/docker/transport/unixconn.py", line 30, in connect sock.connect(self.unix_socket) FileNotFoundError: [Errno 2] No such file or directory During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/requests/adapters.py", line 450, in send timeout=timeout File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 803, in urlopen method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2] File "/usr/local/lib/python3.6/site-packages/urllib3/util/retry.py", line 552, in increment raise six.reraise(type(error), error, _stacktrace) File "/usr/local/lib/python3.这是什么问题如何解决
最新发布
06-06
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值