Configure Proxy Connection

Upon first running my code I revived this error attempting to connect to "" which is included on the free whitelist :

Traceback (most recent call last):
  File "/home/Jaxkey/.local/lib/python3.9/site-packages/deepl/", line 168, in _internal_request
    response = self._session.send(
  File "/usr/local/lib/python3.9/site-packages/requests/", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/requests/", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='', port=443): Max retries exceeded with url: /v2/translate (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection ob
ject at 0x7f6d709f60a0>: Failed to establish a new connection: [Errno 111] Connection refused'))

On this guide it describes manually configuring a proxy connection which you can do through DeepL's API using

deepl.Translator('API KEY', proxy='PROXY')

so I figured that may solve the issue. What should I actually put in for the PythonAnywhere proxy? I see it says "proxy.server:3128" in the guide, however I don't know what that means or how to implement it correctly.

Thank you for the help!

Try using 'http://proxy.server:3128' as a value of the proxy kwarg.

That did the trick! Thanks for the help!

Glad to hear that!

Hi, I am trying to integrate telegram. I know '' is whitelisted. I also configured the proxy, still getting the error.

import telepot
from time import sleep

TOKEN = ****
receiver = ****
telepot.api.set_proxy( 'http://proxy.server:3128')
bot = telepot.Bot(TOKEN)

for i in range(1200):
    bot.sendMessage(receiver, str(i))

but I'm still getting the error:

Traceback (most recent call last):
 File "/usr/lib/python3.8/site-packages/urllib3/", line 158, in _new_conn
conn = connection.create_connection(
 File "/usr/lib/python3.8/site-packages/urllib3/util/", line 80, in create_connection
raise err
 File "/usr/lib/python3.8/site-packages/urllib3/util/", line 70, in create_connection
 OSError: [Errno 101] Network is unreachable

Check docs of the library you are using and make sure that that's a correct configuration.

For people trying to use the "" API. In order to configure according to the libraries http.client, you might need:

proxy_server = 'proxy.server' proxy_port = 3128

  1. conn = http.client.HTTPSConnection(proxy_server, proxy_port) ->> setting the proxy

  2. conn.set_tunnel('') ->> setting the destination

The rest remains the same.

Thanks for posting that!