Start a new topic
Answered

I get 407 "Bad Auth" error message from Crawlera

Hi,

I have setup mu Python client to use crawlera proxy based on a sample on thee crawlera documention. But I get bad auth (407) error message from requests.
I double checked the API-key, host and port and other settings. But everything seems correct!
Here's my code (with api-key placeholder):

proxy_host = "proxy.crawlera.com"
proxy_port = "8010"
proxy_auth = "my_api_key:"
proxies = {"https": "https://{}@{}:{}/".format(proxy_auth, proxy_host, proxy_port),
"http": "http://{}@{}:{}/".format(proxy_auth, proxy_host, proxy_port)} res = requests.get(query_url, roxies=proxies, verify=False, allow_redirects=False)

Can you please help me to get my client working?



Best Answer

Sharing your own solution provided:


I updated my requests client to 2.19.0 version and now it works fine!

Thanks for sharing!


Best,


Pablo


Answer

Sharing your own solution provided:


I updated my requests client to 2.19.0 version and now it works fine!

Thanks for sharing!


Best,


Pablo


1 person likes this

I'm sorry, could you elaborate on the requests client (requests module?) - what is that and how do you update it?


Same issue here - I'm running this on c9.io, not sure if I can update the requests module.


Thank you for your help.


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. Here's the output print from above:

 

    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 update.

 

    $ pip freeze |grep requests

    requests==2.8.1

 

Any ideas?

Are you still facing this issue?

@thriveni, I am facing the same issue right now - I have created several api keys, some of them working (though 503 responses only) and some of them fail with 407 response. I use crawlera with scrapy 1.5. What im doing wrong?


1 person likes this

Same issue no clue 


yes, getting same issue


Connection →close

Date →Tue, 14 Aug 2018 18:53:07 GMT

Proxy-Authenticate →Basic realm="Crawlera"

Proxy-Connection →close

Transfer-Encoding →chunked

X-Crawlera-Error →bad_proxy_auth

X-Crawlera-Version →1.33.1-68f021


kindly update

We are getting same issue on bad proxy authentication.


X-Crawlera-Error →bad_proxy_auth


We are using request npm package with updated version using node js

how to set the proxy_Authorization in request npm package


Login to post a comment