尝试通过代理发出请求时出现问题

时间:2019-01-26 11:47:14

标签: python python-3.x python-requests

这是我的代码:

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

1 个答案:

答案 0 :(得分:2)

根据documentation用户名和密码,将这样传递给代理

proxies = {'http': 'http://user:pass@10.10.1.10:3128/'}