Using Crawlera's sample code for a GET request with a proxy.
import requests
url = "http://httpbin.org/ip"
proxy_host = "proxy.crawlera.com"
proxy_port = "8010"
proxy_auth = "<APIKEY>:" # Make sure to include ':' at the end
proxies = {
"https": "https://{}@{}:{}/".format(proxy_auth, proxy_host, proxy_port),
"http": "http://{}@{}:{}/".format(proxy_auth, proxy_host, proxy_port)
}
r = requests.get(url, proxies=proxies, verify=False)
I get a 407 Bad Proxy Auth error. I've tripled check that the API_KEY is correct.
Response headers:
{
'Proxy-Connection': 'close',
'Proxy-Authenticate': 'Basic realm="Crawlera"',
'Transfer-Encoding': 'chunked',
'Connection': 'close',
'Date': 'Mon, 26 Mar 2018 11:18:05 GMT',
'X-Crawlera-Error': 'bad_proxy_auth',
'X-Crawlera-Version': '1.32.0-07c786'
}
Requests is already updated.
$ pip freeze |grep requests
requests==2.8.1