Python requests.packages.urllib3.connection.VerifiedHTTPSConnection [Errno 11004]
Question:
So I’m pretty unfamiliar with proxies, but seem to be having an issue regarding them. I see a bunch of similar seeming questions but have been unable to make heads or tails of the responses.
I’ve written some Python (3.4.3) code to iteratively download a bunch of excel files from an https:// site (I’ll call it https_url since its really long) using the requests module
requests.get(https_url)
Whenever I run the code on my own work laptop or my computer at home it works fine, but if anyone else at work tries to use it they get the following:
HTTPSConnectionPool(host='secure.conservation.ca.gov', port=443): Max retries exceeded with url: https_url (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000000000A8EE390>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',))
After this I tried using get without verification:
requests.get(https_url, verify=False)
Again to no avail. Works on my machines, but on no one else’s.
Through reading other answers I have tried two additional things:
1) copy about a dozen different .pem files from places like certifi and reference those as requests.get(https_url, verify=xyz.pem)
which again works on my machines (work + home), but on no one else’s.
2) download my wpad.dat, and reference what I believe to be the proxy server contained in that file: requests.get(https_url, proxies={'https': proxy_host:proxy_port})
to which I get the following on all machines:
HTTPSConnectionPool(host='secure.conservation.ca.gov', port=443): Max retries exceeded with url: https_url (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required ( Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied. )',)))
I’m at a loss for what to try next. I don’t understand what is causing it to work normal on my computers, but none others at work. Surely if there was a proxy issue, it would affect my work laptop too? Any thoughts?
Thanks!
Answers:
What solved the problem for me was to remove the ‘https://’ from the URL string.
I was trying to use f5 SDK which demanded:
x = BigIP('url', user, pass)
First I tried:
x = BigIP(https://example.url.com, user, pass)
I got a similar error to what you’re describing, to solve it I did:
x = BigIP(example.url.com, user, pass)
hope this helps.
This is indeed a proxy issue.
In linux, set the following environnement variables:
export http_proxy="http://localhost:<proxy_port>"
export https_proxy="http://localhost:<proxy_port>"
In windows, I guess you need to go to Settings -> Network & Internet -> Proxy
So I’m pretty unfamiliar with proxies, but seem to be having an issue regarding them. I see a bunch of similar seeming questions but have been unable to make heads or tails of the responses.
I’ve written some Python (3.4.3) code to iteratively download a bunch of excel files from an https:// site (I’ll call it https_url since its really long) using the requests module
requests.get(https_url)
Whenever I run the code on my own work laptop or my computer at home it works fine, but if anyone else at work tries to use it they get the following:
HTTPSConnectionPool(host='secure.conservation.ca.gov', port=443): Max retries exceeded with url: https_url (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000000000A8EE390>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',))
After this I tried using get without verification:
requests.get(https_url, verify=False)
Again to no avail. Works on my machines, but on no one else’s.
Through reading other answers I have tried two additional things:
1) copy about a dozen different .pem files from places like certifi and reference those as requests.get(https_url, verify=xyz.pem)
which again works on my machines (work + home), but on no one else’s.
2) download my wpad.dat, and reference what I believe to be the proxy server contained in that file: requests.get(https_url, proxies={'https': proxy_host:proxy_port})
to which I get the following on all machines:
HTTPSConnectionPool(host='secure.conservation.ca.gov', port=443): Max retries exceeded with url: https_url (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required ( Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied. )',)))
I’m at a loss for what to try next. I don’t understand what is causing it to work normal on my computers, but none others at work. Surely if there was a proxy issue, it would affect my work laptop too? Any thoughts?
Thanks!
What solved the problem for me was to remove the ‘https://’ from the URL string.
I was trying to use f5 SDK which demanded:
x = BigIP('url', user, pass)
First I tried:
x = BigIP(https://example.url.com, user, pass)
I got a similar error to what you’re describing, to solve it I did:
x = BigIP(example.url.com, user, pass)
hope this helps.
This is indeed a proxy issue.
In linux, set the following environnement variables:
export http_proxy="http://localhost:<proxy_port>"
export https_proxy="http://localhost:<proxy_port>"
In windows, I guess you need to go to Settings -> Network & Internet -> Proxy