V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
bestehen
V2EX  ›  Python

Python 中代理 ip 问题 报错

  •  
  •   bestehen · 2018-08-15 13:44:52 +08:00 · 1638 次点击
    这是一个创建于 2325 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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 请人看一下这是啥问题,谢谢!
    holajamc
        1
    holajamc  
       2018-08-15 16:00:29 +08:00
    所以上一下代码吧……
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1070 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 19:46 · PVG 03:46 · LAX 11:46 · JFK 14:46
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.