为什么代理提供商生成相同的代理?

问题描述 投票:0回答:0

代理提供商多次提供相同的代理字符串;

endpoint.proxyprovidername.com:port
endpoint.proxyprovidername.com:port
endpoint.proxyprovidername.com:port
endpoint.proxyprovidername.com:port
endpoint.proxyprovidername.com:port
endpoint.proxyprovidername.com:port
endpoint.proxyprovidername.com:port
endpoint.proxyprovidername.com:port
endpoint.proxyprovidername.com:port
endpoint.proxyprovidername.com:port

为什么要这样做,因为提供的代理是相同的字符串? 以下面为例;

import requests

proxy: str = "endpoint.proxyprovidername.com:port"
proxies: dict = {
  'http': f'http://{proxy}',
  'https': f'https://{proxy}'
}

url: str = 'https://www.example.com'

response = requests.get(url, proxies=proxies)

print(response.text)

使用变量

proxy
比遍历相同字符串的列表有什么不同吗?

python-requests proxy request http-proxy request-headers
© www.soinside.com 2019 - 2024. All rights reserved.