Forums

Problem using urllib3

111

That's because you have a free account. Code running under free accounts has to access the Internet using a proxy, which I think has to be explicitly specified when you use urllib3. You can find the connection details by running echo $http_proxy in a bash console, or, if you use the requests library instead of urllib3, it will be picked up from the environment variable automatically.

However, there's still one further step -- the proxy only allows access to sites on our whitelist, which is a set of sites with public APIs. We had to impose that restriction because people were using free PythonAnywhere accounts to hack other websites. So if the site you want your code to connect to is on the whitelist, you'll be OK. If it's not, but it has a public API, then let us know and we'll whitelist it. If it doesn't have a public API then your only option will be to switch to a paid account.

111

No problem, glad to help!