相关疑难解决方法(0)

Python"请求"模块的代理

关于Python 的优秀Requests模块,这只是一个简短的,简单的.

我似乎无法在文档中找到变量'proxies'应​​包含的内容.当我发送一个带有标准"IP:PORT"值的字典时,它拒绝了它要求2个值.所以,我猜(因为这似乎没有在文档中说明)第一个值是ip而第二个是端口?

文档只提到这个:

proxies - (可选)字典映射协议到代理的URL.

所以我试过了......我该怎么办?

proxy = { ip: port}
Run Code Online (Sandbox Code Playgroud)

在将它们放入dict之前,我应该将它们转换成某种类型吗?

r = requests.get(url,headers=headers,proxies=proxy)
Run Code Online (Sandbox Code Playgroud)

python http-request python-requests

145
推荐指数
7
解决办法
24万
查看次数

标签 统计

http-request ×1

python ×1

python-requests ×1