Forums

OSError: Tunnel connection failed: 403 Forbidden

I want to run a daily task that gets some small .json files and uses them to update a .txt file in my folder. To do this I use a wrapper library for the API I am accessing (brawlstats).

Running the task I get the error:

OSError: Tunnel connection failed: 403 Forbidden

As well as

urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.brawlapi.cf', port=443): Max retries exceeded with url: /v1/leaderboards/players?count=200&brawler=shelly (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden')))

I'd like to know how I could run daily tasks with outbound internet usage? Would it work if I bought a premium membership?

A paid account can be used to access any website, but there is a whitelist of APIs that can be accessed from free accounts. The PythonAnywhere devs can add any requested API to the whitelist. You must also provide a link to the API's documentation to request it.

+1 to what @dull says -- @brawlrank, if that's a documented public API that you're trying access, just send us a link to the API docs and we'll add it to the whitelist.

From my pythonAnywhere app I send a get request to a external webserver and in the console i get following error message, see below. Sending the same request in my mozilla forefox webbrowser I get a JSON response. Can you add the url to your pythonAnywhere white-list or do I need a paid account? Mayn thanks for your help. Fred59

Traceback (most recent call last): File "/home/Fred59status/mysite/flask_app.py", line 41, in <module> response_status = requests.get(urlAPI + order_id) # raise OSError("Tunnel connection failed: %d %s" % (code, OSError: Tunnel connection failed: 403 Forbidden File "/usr/lib/python3.8/site-packages/requests/api.py", line 75, in get return request('get', url, params=params, kwargs) File "/usr/lib/python3.8/site-packages/requests/api.py", line 60, in request return session.request(method=method, url=url, kwargs) File "/usr/lib/python3.8/site-packages/requests/sessions.py", line 533, in request resp = self.send(prep, send_kwargs) File "/usr/lib/python3.8/site-packages/requests/sessions.py", line 646, in send r = adapter.send(request, kwargs) File "/usr/lib/python3.8/site-packages/requests/adapters.py", line 510, in send raise ProxyError(e, request=request) requests.exceptions.ProxyError: HTTPSConnectionPool(host='www.vitaland.ch', port=443): Max retries exceeded with url: /scripts/get_order_data.php?api_key=XXXXXXXXXXXXXXXX &order_id=200496459 (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden')))

if you can show us public api documentation, then we can add it to the whitelist. Otherwise you may need to get a paid account.

Hi there!

Could you put url https://cti-taxii.mitre.org of Mitre TAXII API in PA Proxy Whitelist?

I'm getting this proxy error:

HTTPSConnectionPool(host='cti-taxii.mitre.org', port=443): Max retries exceeded with url: /stix/collections/95ecc380-afe9-11e4-9b6c-751b66dd541e/ (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden',)))

It's the Mitre service (Taxii), about cybersecurity

Link to *Public documentations about Mitre Taxii Service: *

No problem. I've added that to the whitelist.

Hi there Could you please add the url "https://www.worldometers.info/coronavirus/" "https://www.worldometers.info/coronavirus/country/ethiopia/" to the whitelist..

We can only whitelist sites with an official public API -- if that site has one, could you post a link to the API documentation?

https://www.who.int/data/gho/info/athena-api Ok...what about this...

Sure, I've whitelisted the host described on that page, apps.who.int.

can you whitelist 'https://www.worldometers.info/coronavirus/'

We can only whitelist sites with an official public API -- if that site has one, could you post a link to the API documentation?

Please! Can you add to whitelist https://developerhub.alfabank.by/.
Error: HTTPSConnectionPool(host='developerhub.alfabank.by', port=8273): Max retries exceeded with url: /token/ (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden',)))

It doesn't look like that will work, since that API appears to use a non-standard port. Free accounts can only connect out on ports 80 and 443 (the standard http and https ports), so adding that to the whitelist would have no effect.

if I switch to Hacker I be able to use request HTTPSConnectionPool(host='developerhub.alfabank.by', port=8273) without errors ?

Yes, if the errors you're getting are because it cannot connect to the site.

How quickly will my website work if I pay now and do I need to change something in the settings?

When you upgrade you need to restart consoles, web apps, etc. for it to take effect

Is it possible to whitelist my bot’s website so that I can use my API or do I need to make documentation?

When we whitelist a site, it's whitelisted for all free users (including people using the console on the front page of python.org), not just for one account. So your bot would need to offer a general public API that people could use before we could whitelist it.

Please! Can you add to whitelist https://api.sypexgeo.net/json/ requests.exceptions.ProxyError: HTTPSConnectionPool(host='api.sypexgeo.net', port=443): Max retries exceeded with url: /json/ (Caused by ProxyError('Cannot connect to proxy.', OSErr or('Tunnel connection failed: 403 Forbidden'))) https://sypexgeo.net/ru/api/ - official Rest API Doc Thank you

Sure! That's whitelisted now.