Python Forum

Full Version: Python error on pythonanywhere
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello,

so I have this error on deployment, I don't know if it's due to the constraints of my deployment server (pythonanywhere) or if it's related to something else.
My code works locally, but when I put it in my distant server and run it, it fails with a ClientConnectionError "Cannot connect to host [api_host]:443 ssl:default [Connect call failed ('api_ip', 443)]" where api_host/api_ip of another distant host I'm trying to contact with my code.
The exception is thrown from .local/lib/python3.8/site-packages/aiohttp/connector.py in _wrap_create_connection, line 943.

Is this a limitation of pythonanywhere regarding concurrent network calls ? (it works without the concurrent version). Or a python version problem ? Or something else ?

Please help me figuring out what's wrong,

Thx
is it free account or paid one? free accounts are only allowed to connect to white-listed sites
It is a free account indeed, but it is part of the white-listed site, and works in sync mode. But I just coded an async version, and now it fails.
I suggest trying it with verify_ssl = False in you aiohttp request
Thanks for the idea, but didn't work. Anyway it wouldn't have explained why it works locally and not on pythonanywhere, or why it works with the sync'ed version and not async'ed.
OKay so it appears pythonanywhere only sets up the http request, through a proxy (that whitelists some hosts though the one I'm interested in is whitelisted), and the websocket API that is used by aiohttp is not properly configured, so I get a connect failed error. Is there any way around that ?
(Sep-22-2020, 02:00 AM)lukee Wrote: [ -> ]it appears pythonanywhere only sets up the http request,
I am not sure this is true. On the plan comparing page they claim "Specific sites via HTTP(S) only"
It is true though, I've tried changing just one line from requests.get to session.get and in the later case it fails with a connect issue.
See here, here or here.

So is there a way to configure the proxy manually? How can they set this restriction anyway ?

In the end I need to be able to make multiple concurrent API calls, whatever the means.

Thx
So any idea plz ?
I'm stuck on this question, it's way past my knowledge, so if someone could help me I'd be grateful.
Pages: 1 2