我正在尝试使用代理执行请求。
我的代码:
import requests
proxies = {'http' '1.1.1.1:1234'}
r = requests.get('https://httpbin.org/ip', proxies=proxies)
print(r.text)
错误:
no_proxy = proxies.get('no_proxy') if proxies is not None else None
AttributeError: 'set' object has no attribute 'get'
编辑:
我错过了一场比赛
新代码:
import requests
proxies = {'http': '1.1.1.1:1234'}
r = requests.get('https://httpbin.org/ip', proxies=proxies)
print(r.text)
您的字典中缺少一个
:
:如果您有
proxies = {'http' '1.1.1.1:1234'}
,那么proxies
实际上是一个set
,具有单个值'http1.1.1.1:1234'
,因此出现错误相关问题 更多 >
编程相关推荐