Forums

Receiving squid "access denied" error on POST

Python and PythonAnywhere newbie here:

I've created a python script over at Pyfiddle which uses the Requests library to POST to an api endpoint. Everything works as expected in the fiddle, but when I save my script as a file on PythonAnywhere and run it, the POST responds with a 403 and the following unexpected header:

{'Server': 'squid/3.5.12', 'Mime-Version': '1.0', 'Date': 'Thu, 02 Aug 2018 16:45:51 GMT', 'Content-Type': 'text/html;charset=utf-8', 'Content-Length': '810', 'X-Squid-Error': 'ERR_ACCESS_DENIED 0', 'X
-Cache': 'MISS from giles-liveproxy1', 'X-Cache-Lookup': 'NONE from giles-liveproxy1:3128', 'Via': '1.1 giles-liveproxy1 (squid/3.5.12)', 'Connection': 'keep-alive'}

My assumption is that this response is from PythonAnywhere as opposed to my endpoint.

Does anyone have any enlightening info?

Thanks in advance.

Ah - nevermind. This is a limitation of the free account. My endpoint was not on the free account whitelist.

Yup, that's right -- if the endpoint is an official public API, we can probably whitelist it -- just send us a link to the API docs.