Forums

Failed to establish a new connection: [Errno 101] Network is un reachable'

Hello, I upload my code on PythonAnywhere, but i've got this error: Failed to establish a new connection: [Errno 101] Network is un reachable On my notebook, it works perfectly.

What can i do to make it work? Thank you.

You have a free account. Free accounts need to use our proxy to reach the internet. Details here: http://help.pythonanywhere.com/pages/403ForbiddenError/

Thank you for reply. I' making a telegram bot that tells the weather. i'm using telepot libray: http://telepot.readthedocs.io/en/latest/

I get the weather info from this api: https://openweathermap.org/api

using pyowm library: https://github.com/csparpa/pyowm/blob/master/pyowm/docs/usage-examples.md

On my computer it works, what can i do to make it works also here on pythonanywhere?

Thank you.

Which part doesn't work on PythonAnywhere?

I'm sorry,

But i'm new to python and telegram bot,.

I'm not expert in programming, and i don't know how to write the code that use the proxy.

I searched online for examples of using the libraries with proxy, but i didn't find anything.

Should i leave pythonanywhere?

so there's a lot of moving parts that you described. can you look at/share the error traceback so that we know if you are having problems with connecting to telepot vs getting weather info vs using pyowm?

I got this error:

 File "/usr/local/lib/python2.7/dist-packages/urllib3/util/retry.py", line 287, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
MaxRetryError: HTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded with url: /bot436165874:AAFdH4xhrjGf1QYLCpZwbeZ_DOuGMEaUL-w/getUpdates
 (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f10bcb6b610>: Failed to establish a new connection: [Errno 101] Network i
s unreachable',))

Thank you

[edit by admin: formatting]

We have a tutorial on writing a simple Telegram bot using PythonAnywhere -- maybe the best way to get started would be to work through that, then adapt the result to use the code that you currently have. In particular, it includes code to connect to Telegram via the proxy that free accounts on PythonAnywhere need to use.