python - 尝试使用代理发出请求时出现问题
问题描述
这是我的代码:
headers = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36",
"referer": "https://steamcommunity.com/profiles/{}/inventory".format(options['steamid'])
}
url = 'https://steamcommunity.com/inventory/{}/{}/{}?l={}&count={}&start_assetid={}'.format(options['steamid'], options['appid'], options['contextid'], options['language'], options['count'], last_assetid)
proxy = self.proxy()
proxies = {
'http': proxy,
'https': proxy
}
req = requests.get(url=url, headers=headers, proxies=proxies, timeout=self.timeout)
代理(打印时):{'http': ' https://91.188.243.130:9049:xxx:xxx ', 'https': ' https://91.188.243.130:9049:xxx:xxx '}
我得到的错误:无法解析:91.188.241.137:9049:xxx:xxx
解决方案
根据文档,用户名和密码被传递给这样的代理
proxies = {'http': 'http://user:pass@10.10.1.10:3128/'}
推荐阅读
- javascript - 如何使正则表达式模式文本框中的装饰器无法选择?
- asp.net-web-api - 日志
从未调用自定义 ILogger/ILogProvider 实现 - javascript - 当我在浏览器中切换 Metamask 地址时,Web3 getAccounts 不更新
- time-series - R,贝叶斯预测,预测数据的趋势与原始数据相差很大
- excel - Excel 函数 - 合并单元格的返回值
- ios - 更改上下文菜单的背景颜色和字体样式
- swift - Swift - 如何在菜单栏中为 NSImage 设置动画(不透明度 0 和 1 之间的脉冲)?
- python - 基于字典信息标注坐标
- python-3.x - 文件中的石头剪刀布
- share - LinkedIn分享使用og不显示文本