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 19:35:19 +08:00 · 1256 次点击
    这是一个创建于 2073 天前的主题,其中的信息可能已经有所发展或是发生改变。
    self.auth = HTTPProxyAuth("te815w", "te815w")
    self.proxies = {"http": "112.29.173.117:888"}

    self.auth_1 = HTTPProxyAuth("te8152", "te815w")
    self.proxies_1 = {"http": "112.29.170.61:888"}
    self.auth_list = [(self.auth, self.proxies), (self.auth_1, self.proxies_1)]

    我是这样写的 报错,总是说我 ip 没有授权,我一个测试是没有问题的,搞成一个列表报错


    enter into list
    <requests.auth.HTTPProxyAuth object at 0x7fa4d5e236d8> {'http': '112.29.170.61:888'}
    获取内容
    <requests.auth.HTTPProxyAuth object at 0x7fa4d5e236d8>
    {'http': '112.29.170.61:888'}
    ticket=bbf405041bac5120a5547cf069cda1aa
    id =21d2ec857faef2cf6df662abe4e41322

    841442 http://vip.qimingpian.com/#/detailorg?src=magic&ticket=bbf405041bac5120a5547cf069cda1aa&id=21d2ec857faef2cf6df662abe4e41322
    <html>
    <head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>
    <body>
    <h1>Unauthorized ...</h1>
    <h2>
    IP Address: 60.205.219.253:35544<br>
    MAC Address: <br>
    Server Time: 2018-08-15 19:32:07<br>
    Auth Result:
    </h2>
    </body>
    </html>
    Traceback (most recent call last):
    File "run.py", line 56, in <module>
    run().get_spider()
    File "run.py", line 18, in get_spider
    qimingpian().get_id_and_url()
    File "/home/shenjianlin/my_project/qimingpian_person/qimingpian_person.py", line 219, in get_id_and_url
    self.get_agency_content(row_column_list[i - 1], row_column_list[i], auth, proxies,user_index)
    File "/home/shenjianlin/my_project/qimingpian_person/qimingpian_person.py", line 246, in get_agency_content
    json_data = json.loads(response.text)
    File "/usr/lib64/python3.4/json/__init__.py", line 318, in loads
    return _default_decoder.decode(s)
    File "/usr/lib64/python3.4/json/decoder.py", line 343, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    File "/usr/lib64/python3.4/json/decoder.py", line 361, in raw_decode
    raise ValueError(errmsg("Expecting value", s, err.value)) from None
    ValueError: Expecting value: line 1 column 1 (char 0)
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   4752 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 09:56 · PVG 17:56 · LAX 02:56 · JFK 05:56
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.