Forums

urlretrieve > Error tunnel connection failed : 403 forbidden

Hi, I want to ask my error, I want to parse this website ( https://latex.codecogs.com/gif.latex? ). my function looks like this for short:

def Ltx(eq):
    try:
        url = "https://latex.codecogs.com/gif.latex?{}".format(eq)
        urlretrieve(url, directory) # download LaTeX equations image
    except Exception as ex:
        return ex

and It returns error "Error tunnel connection failed : 403 forbidden". This link is not on whitelist, and I used it well until yesterday. Please help me :(

It's very unlikely that that code would have ever worked in a free account. You're getting that error because you are not using the proxy (see https://help.pythonanywhere.com/pages/403ForbiddenError/ for more details). However, once you're using the proxy, you are likely to find that it fails because the site is not on the whitelist. If the site has a publicly documented API, then send us a link to the documentation and we'll consider it for the whitelist.