Why do I get a "403 Forbidden" or "[Errno 111] Connection refused" error when accessing a website from PythonAnywhere?
Free accounts' internet access goes via a proxy "whitelist". Here is the list of sites currently allowed:
We operate this to prevent malicious users from using our site to hack into and spam other websites. Paid-for accounts don't have this limitation, because we can connect them to real people. Spammers and criminals prefer to be anonymous, so we figure they're unlikely to sign up for paid accounts here.
[Errno 111] Connection refused
This error suggests that either the library you're using doesn't support using a proxy, or that it needs to be configured to use a proxy. Have a look at the docs for the library to determine which it is and consider raising an issue with the project about proxy support.
In order to make a connection to a whitelisted site, you will need to connect
through our proxy server. This is an HTTP proxy at
Python libraries recognise and use the setting that we supply (for
requests, you don't need to do anything special), others need
to be specifically configured to use the proxy (check the documentation of the
library to find out how) and some don't work through the proxy at all (for
instance, any library that uses httplib2 on Python 3 e.g.
Upgrading your account
Paying users have unrestricted access. You can upgrade your account here.
After you upgrade you'll need to kill any old consoles and start new ones to get your new Internet settings. You'll also need to restart any webapps and scheduled tasks.
Requesting an addition to the whitelist
See this page