My application running with Uwsgi on the server that using proxy. The server proxy is in one network. But whenever the application trying to make https request (443), it raises an error like it cannot connect to internet.
HTTPSConnectionPool(host='api.blabla.com', port=443): Max retries exceeded with url: /endpoint/v2/checkout_url (Caused by NewConnectionError(': Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))
for proxy, I'm using squid for http and https. and for the client side, the proxy has been setup system-wide.
Kindly need advice from this issue. thanks in advance.
Related
I am calling a REST API to Informatica from POSTMAN and Python (requests library) and find the behavior quite funny.
When I am on VPN I can only make a successful call from POSTMAN, however if I switch VPN off both Python and POSTMAN calls work perfectly.
Python script generated automatically by POSTMAN.
Error:
ConnectionError: HTTPSConnectionPool(host='use4-mdm.dm-us.informaticacloud.com', port=443): Max retries exceeded with url: /rdm-service/external/v2/export (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000002393AB297C0>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))
Any ideas what the reason might be?
UPD
To make my question more clear:
This is a corporate VPN on work laptop
My system does not have *_PROXY variables
No default proxy in requests library
import requests
session = requests.Session()
session.proxies
>>> {}
http.client library - same result
Settings in POSTMAN are in screenshot below
you may want to have a look at the "proxies" parameter of python requests :)
we recently configured aws privatelink to snowflake account and updated python connector (v.1.8.0) properties to use privatelink URL.
Connection keeps failing with below error.
Failed to execute request: HTTPSConnectionPool(host='testaccount.us-west-2.privatelink.snowflakecomputing.com', port=443): Max retries exceeded with url: /session/v1/login-request?warehouse=TEST_WH&request_id=12345&request_guid=f5467 (Caused by ProtocolError('Connection aborted.', BadStatusLine("''",)))
Has anyone encountered this issue when using AWS privatelink?
Any inputs would be greatly appreciated.
On the host where you are running python, if linux or OSX, can you run:
curl -v -L https://testaccount.us-west-2.privatelink.snowflakecomputing.com:443
Do you know if you have a proxy in place allowing your Web URL to work?
https://www.digitalcitizen.life/how-set-proxy-server-all-major-internet-browsers-windows
That error is because the python code is unable to reach the privatelink URL. Either it's on a host that is blocked, there is a firewall blocking, or you require a proxy.
On linux I started a server at localhost:8090. From a docker container through Jupyter notebook I am trying to send a PUT request to the localhost server. GET requests seem to work just fine from the docker container but PUT requests show the following error.
ConnectionError: HTTPConnectionPool(host='localhost', port=8090): Max retries exceeded with url: /xxxxx/xxxxx/xxxxx (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f6b9ee1d978>: Failed to establish a new connection: [Errno 111] Connection refused'))
Using curl from local terminal, I am able to send a PUT request without any problem.
The PUT requests seemed to be working in first 1-2 hours (even from the docker container) but then the error started appearing. Is it possible that there are some connections still alive and the server cannot accept any more? Restarting the server and my machine did not fix the problem.
CondaHTTPError: HTTP 000 CONNECTION FAILED for url https://repo.anaconda.com/pkgs/free/win-64/repodata.json.bz2
Elapsed: -
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
If your current network has https://www.anaconda.com blocked, please file
a support request with your network engineering team.
ConnectionError(MaxRetryError("HTTPSConnectionPool(host='repo.anaconda.com', port=443): Max retries exceeded with url: /pkgs/free/win-64/repodata.json.bz2 (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 11001] getaddrinfo failed',))",),)
You are having issues with ssl. Some of these have entered in recent releases for us (using self signed keys) and so we have had to switch ssl_verification off in conda.
This wasn't enough though, and we also had to manually remove the REQUESTS_CA_BUNDLE environment variable that we were using to specify the path to the SSL certificate.
# Remove SSL
conda config --set ssl_verify false
See github issue here - https://github.com/ContinuumIO/anaconda-issues/issues/10340
I am working in a corporate environment with a proxy (with user/passs). I use PyCharm on a Windows machine and Python 3.6.
Based on this post:
How to pass all Python's traffics through a http proxy? I managed to write my python script that connects to the web.
Unfortunately I had to reinstall Pycharm and create a new python project. Now I run the same script that connects to the web but receive the following error message (simply trying to connect to google.com):
requests.exceptions.SSLError: HTTPSConnectionPool(host='www.google.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)'),))
This is my code:
import os
proxy = 'http://user:password#proxyname:port'
os.environ['http_proxy'] = proxy
os.environ['HTTP_PROXY'] = proxy
os.environ['https_proxy'] = proxy
os.environ['HTTPS_PROXY'] = proxy
import requests
r = requests.get('https://www.google.com')
print(r.text)
If I change the line
r = requests.get('https://www.google.com')
to this:
r = requests.get('https://www.google.com', verify=False)
it works but I receive the warning:
InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised.
Executing the code on another machine without proxy This issue doesn't appear at all.
I added google's certificate in PyCharm's settings (Settings -> Tools -> Server Certificates) and selected "Accept non-trusted certificates automatically". But nothing changes, same error messages.
Is there any further settings I can do in PyCharm/Python to solve that issue?