Python 换 ip 的问题

2018-08-15 19:35:19 +08:00
 bestehen
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)
1371 次点击
所在节点    Python
0 条回复

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

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

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

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

© 2021 V2EX