Black Lives Matter. Please consider donating to Black Girls Code today.

Python Proxy Connection Error

I am working on Python 3.7 (PyCharm) behind a company authenticated proxy. I have searched for a solution to my error codes, but I have not found much. I have set up HTTP_PROXY and HTTPS_PROXY environment variables and changed my Internet Option/LAN settings.

Error Codes:

TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

During handling of the above exception, another exception occurred: urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x000000114C52C860>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host=‘plot.ly’, port=443): Max retries exceeded with url: /clientresp (Caused by NewConnectionError(’<urllib3.connection.VerifiedHTTPSConnection object at 0x000000114C52C860>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond’))

requests.exceptions.ConnectionError: HTTPSConnectionPool(host=‘plot.ly’, port=443): Max retries exceeded with url: /clientresp (Caused by NewConnectionError(’<urllib3.connection.VerifiedHTTPSConnection object at 0x000000114C52C860>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond’))

plotly.exceptions.PlotlyRequestError: No message.

I am implementing using:

import urllib3
import certifi
from urllib3 import ProxyManager, make_headers
default_headers = urllib3.make_headers(proxy_basic_auth = ‘username:password’)
http = urllib3.ProxyManager(‘proxy/’,
_ headers = default_headers)_

r = http.request(‘GET’, ‘http://plot.ly’)

import plotly.plotly as py
import plotly.graph_objs as go
import plotly
plotly.tools.set_credentials_file(username=‘plotlyusername’, api_key=‘apikey’)
plotly.tools.set_config_file(world_readable = False, sharing = ‘private’)

trace0 = go.Scatter(
_ x=[1, 2, 3, 4],_
_ y=[10, 15, 13, 17]_
)
trace1 = go.Scatter(
_ x=[1, 2, 3, 4],_
_ y=[16, 5, 11, 9]_
)
data = [trace0, trace1]

py.plot(data, filename = ‘basic-line’, auto_open=True)

1 Like