Forums

urllib.error.URLError: <urlopen error Tunnel connection failed: 403 Forbidden

Hello,

i'm trying to connect to the website import.io using urllib.request.Request but I get the following error:

urllib.error.URLError: <urlopen error Tunnel connection failed: 403 Forbidden

I don;t have that error if I run the script from my PC. Do you have any idea to solve the issue?

Many thanks Dario

Hello, I read some posts here in the forum about the same error I get. It seems the external website that I'm trying to use is not included in your proxy white list

The website is https://www.import.io/

Please let me know if it's possible to get access to that website.

Many thanks Dario

The api endpoint for import.io (api.import.io) is already on the whitelist. Are you configuring your code to use the proxy? The proxy address is proxy.server:3128

Thanks Glen,

I configured the proxy but I still get "IOError: [Errno socket error] [Errno 111] Connection refused"

Maybe the reason is that import.io offers other URLs that are not included in the whitelist. In particular I'm using:

https://extraction.import.io https://data.import.io/

Is it possible to add those URLs?

Many thanks Dario

Hi Dario -- if you're getting a connection refused error, your code must be missing the proxy somehow -- a failure due to something not being on the whitelist would give you the 403 forbidden error you got originally.

Could you post your proxy setup code?

(If it's not something you'd like to share publicly, you can email it to us at support@pythonanywhere.com)

Hi Glen, I am also getting same error. did you find any silution for this error? If you found, please let me know

See this explanation and do this after checking what you are trying to access isn't on this

hi there, i have also same problem, when I try to get an image from URL (eg: "https://api.twilio.com/2010-04-01/Accounts/AC86a729d2c869f0ad33c9bb7974ddcae7/Messages/MM566185e8df7eecc50475daf93d2e8094/Media/MEc39b6f6bb1faa2d362d68cbf61375010")

I got an error like: <urlopen error Tunnel connection failed: 403 Forbidden> code for that: resp = urlopen(URL) image = np.asarray(bytearray(resp.read()), dtype="uint8") image = cv2.imdecode(image, cv2.IMREAD_COLOR)

can u pls respond to this issue asap I am working on my final yr project and I have 15 days left for this so pls resolve my issue as fast

twilio is already on the whitelist

Hello, i'm getting the same error when i try to access https://fundamentus.com.br, can someone help me how to implement some proxy to request or any other way? I'm using python 3.8

thanks in advance

It's not whitelisted for free users.

Hello, i'm getting the same error when i try to access https://ttsapi.almagu.com/.

Free accounts have restricted Internet access -- they can only make HTTP and HTTPS requests, and the sites that they access must be on the whitelist. We can add new sites to the whitelist if they have an official public API; if that site has one, please post a link to the API documentation.

Can I please ask to whitelist this website: https://api.nextbike.net/maps/nextbike-live.json ?

@tuchlin We can add new sites to the whitelist if they have an official public API; if that site has one, please post a link to the API documentation.

https://github.com/nextbike/api-doc

I don't see a reference to api.nextbike.net there -- could you send a link to a page that mentions that?

Can you possibly white list this site https://bon.navarra.es/*

@sploro We can add new sites to the whitelist if they have an official public API; if that site has one, please post a link to the API documentation. BTW your account is a paid one, so you should not be affected by the whitelist limitations.

Hi, I'm getting the same error with YouTube. Can it be added to the whitelist?

_

Exception Value: <urlopen error Tunnel connection failed: 403 Forbidden> I'm getting the same error with many of the APIs that are already whitelisted. Earlier it was working well but now it is throwing errors like URLError or ProxyError

Pytube is not whitelisted earlier it was but now it is throwing forbidden error.

Official documentation: https://pytube.io/en/latest/api.html

ytmusicapi is also not whitelisted earlier it was.

Official documentation: https://ytmusicapi.readthedocs.io/en/latest/

Hi all, sorry for the slow reply.

We only add sites to the whitelist if they (the sites themselves) have official documented public APIs. We don't actively monitor them, though, so some sites can get whitelisted and then remain on the list even when they're not hosting APIs.

However, someone recently started abusing PythonAnywhere by setting up tens of thousands of junk accounts with code to "watch" a YouTube video. That meant that we had to review our blanked whitelisting of YouTube.com, and we discovered that it no longer seems to have an API hosted there -- its API is now at www.googleapis.com.

If there is a documented API that is on a different hostname, however, do let us know -- we just need a link to its docs.

can u whitelist cassandra-driver please

@ExLinked

Please note we need public api documentation stating the hostname for the endpoint. Please see the URL below for additional information in regards to whitelist requests:

https://help.pythonanywhere.com/pages/RequestingWhitelistAdditions/

pls i am also having the same issue pls help what can i do

What exact issue?

urlopen error Tunnel connection failed: 403 Forbidden
i am using pytube

website link : http://testingdytube.pythonanywhere.com/

Youtube is not on the allowed list for free accounts.

ok you mean i have to upgrade on your server before it can work well

Correct

Hi, can you add the api of youtube to the whitelist?

We can only whitelist sites with an official public API, and then we'd need to see the API documentation. Additionally, www.youtube.com can't be whitelisted, as unfortunately then people use our site to run spam bots that try to boost the views for videos by playing them from code.