Forums

Strange behavior of urllib

Hello, I have two accounts in Pythonanywhere, one paying and the other free. If I run this code

import urllib.request
import shutil

url = "https://onelink/database_name.sdb" 
output_file = "database/database_name.sdb"
with urllib.request.urlopen(url) as response, open(output_file, 'wb') as out_file:
shutil.copyfileobj(response, out_file)

on the paying account it works perfectly, takes database_name.sdb form 'https://onlink' and puts it in the directory database. If i run it in the other account it gives me this error:

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

I don't understand why, the code is the same in both accounts!

Thank you!

for a free account, your external internet access is limited to a whitelist

Ok, thank you very much for your answer, I wil manage now!

Great, glad we could help!