Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden'

I was hoping that someone could shed some light. Trying to make an API call from Nucleus Notebook to Azure API End-Point and get the following error …

Nucleus: … (Caused by ProxyError(‘Cannot connect to proxy.’, OSError(‘Tunnel connection failed: 403 Forbidden’)))

CODE:

import requests
import json;

url = “https://******************.azure.com/”

payload = {
“prompt”: “Python code to test access”,
“max_tokens”: 50,
“temperature”: 0.7
}
headers = {
“Content-Type”: “application/json”,
“Authorization”: “*************************”
}
response = requests.post(url, data=json.dumps(payload), headers=headers)

if response.status_code == 200:
data = json.loads(response.text)
output_text = data[“choices”][0][“text”]
print(output_text)
else:
print(“Error:”, response.status_code, response.text)

Free accounts on the notebook service have restricted Internet access, but public APIs are definitely the kind of thing

1 Like

Excuse me, hit return too soon! …are the kind of thing that we can definitely add to the list of allowed sites. Can I ask you to put in a request with the full URL and a link to the API docs at https://support.anaconda.com/hc/en-us/requests/new ? The issue type would be “Anaconda Notebooks / PythonAnywhere allow list request”.

1 Like

Great! Many thanks. Will do. ps I have a paid service account, not free.

Oh, thanks! Didn’t realise that, the forums don’t show people’s account type. In that case, you should be able to access the site without it being on the list. I’m wondering if perhaps there are some free settings lingering from an earlier session before you upgraded to a paid account – did you use it at all prior to your upgrade?