Python 中代理 ip 问题 报错

2018-08-15 13:44:52 +08:00
 bestehen
File "/usr/lib/python3.4/site-packages/urllib3/connectionpool.py", line 638, in urlopen
339 _stacktrace=sys.exc_info()[2])
340 File "/usr/lib/python3.4/site-packages/urllib3/util/retry.py", line 367, in increment
341 raise six.reraise(type(error), error, _stacktrace)
342 File "/usr/lib/python3.4/site-packages/urllib3/packages/six.py", line 685, in reraise
343 raise value.with_traceback(tb)
344 File "/usr/lib/python3.4/site-packages/urllib3/connectionpool.py", line 600, in urlopen
345 chunked=chunked)
346 File "/usr/lib/python3.4/site-packages/urllib3/connectionpool.py", line 384, in _make_request
347 six.raise_from(e, None)
348 File "<string>", line 2, in raise_from
349 File "/usr/lib/python3.4/site-packages/urllib3/connectionpool.py", line 380, in _make_request
350 httplib_response = conn.getresponse()
351 File "/usr/lib64/python3.4/http/client.py", line 1227, in getresponse
352 response.begin()
353 File "/usr/lib64/python3.4/http/client.py", line 386, in begin
354 version, status, reason = self._read_status()
355 File "/usr/lib64/python3.4/http/client.py", line 356, in _read_status
356 raise BadStatusLine(line)
357 urllib3.exceptions.ProtocolError: ('Connection aborted.', BadStatusLine("''",))
358
359 During handling of the above exception, another exception occurred:
360
361 Traceback (most recent call last):
362 File "/home/shenjianlin/my_project/run.py", line 56, in <module>
363 run().get_spider()
364 File "/home/shenjianlin/my_project/run.py", line 18, in get_spider
365 qimingpian().get_id_and_url()
366 File "/home/shenjianlin/my_project/qimingpian_person/qimingpian_person.py", line 134, in get_id_and_url
367 self.get_agency_content(row_column_list[i -1],row_column_list[i])
368 File "/home/shenjianlin/my_project/qimingpian_person/qimingpian_person.py", line 304, in get_agency_content
369 self.s.get(news_link, auth=self.auth, proxies=self.proxies).content.decode("utf-8")).xpath(
370 File "/usr/lib/python3.4/site-packages/requests/sessions.py", line 525, in get
371 return self.request('GET', url, **kwargs)
372 File "/usr/lib/python3.4/site-packages/requests/sessions.py", line 512, in request
373 resp = self.send(prep, **send_kwargs)
374 File "/usr/lib/python3.4/site-packages/requests/sessions.py", line 622, in send
375 r = adapter.send(request, **kwargs)
376 File "/usr/lib/python3.4/site-packages/requests/adapters.py", line 495, in send
377 raise ConnectionError(err, request=request)
378 requests.exceptions.ConnectionError: ('Connection aborted.', BadStatusLine("''",))

我在网上看到说 https 请求写成 http 请人看一下这是啥问题,谢谢!
1635 次点击
所在节点    Python
1 条回复
holajamc
2018-08-15 16:00:29 +08:00
所以上一下代码吧……

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/480006

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX