Accessing ODK Central with PythonAnywhere

is there any solution or API Endpoint to Accessing ODK central submission from pythonAnywhere cloude
error 403 forbiden

Welcome to the ODK forum, @tekalign! We're glad you're here. When you get a chance, please introduce yourself on this forum thread. I'd also encourage you to add a picture as your avatar because it helps build community!

Have you looked at the OData feed? You can download submissions with Python, R, and more. When using Python, we recommend pyODK. You'll need to follow the instructions to configure your setup with your Central account credentials.

What are the steps you followed that resulted in a 403?

1 Like

i am using pyODK and my python script working very fine from my local machine. the problem is when i try to run from cloud server

Hi @tekalign ,

Error 403 usually has to do with permissions or authentication.

Not really sure how authentication works in your script and from your local machine. On your local machine, if you're using environment variables to store credentials, you may want to ensure that these same env variables are properly configured on the cloud server as well.

1 Like

Hi Clement

i uploaded the same .env on the cloud . is there any registered odk API end point that allow access /submission

How are you confirming that pyODK is successfully reading your pyodk_config.toml file on your cloud server?

Consider sharing the script so we can see what it's doing. Be sure to remove any hard coded passwords before posting it on the forum.

Dear yanokewa

thank you sir, pyODK_config.toml (base_url , username , password , default_project_id ) with appropriate arguments also loaded. (pyODK successfully reading the file from our local machine and connect success fully )

error returned:

requests.exceptions.ProxyError: HTTPSConnectionPool(host='odk-central.swisstph.ch', port=443): Max retries exceeded with url: /v1/sessions (Caused
by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden')))

This is a error that suggests there's something unusual about the server's networking infrastructure. There's probably a proxy between you and the server. I'd recommend you talk with IT.

I work on the same server with pyODK and it works perfectly. It is not a server's networking infrastructure issue

1 Like

Dear sir

Some of the replies given by the pythonanywhere cloud provider for the error i encounterd (.. OSError('Tunnel connection failed: 403 Forbidden') inclde :

  • Tunnel connection failed: 403 Forbidden · requests. · You're getting that error because the site in question is not on our list of whitelisted ...
  • Tunnel connection failed: 403 Forbidden ... Yes, that looks like you're trying to access a site that's not on the allowlist for free accounts. If ...

403 Forbidden error( https://help.pythonanywhere.com/pages/403ForbiddenError/ )
Free accounts' internet access goes via a proxy "allowlist"; they can only access sites that are on that list. Here is the list of sites currently allowed.

Link to Allowlisted sites for free users
Allowlisted sites for free users: PythonAnywhere

hope you help me now to get the solution
Thanks

As described at https://help.pythonanywhere.com/pages/403ForbiddenError, your PythonAnywhere account doesn't allow connection to the arbitrary servers. Either switch to a paid plan or try Google CoLab.

Dear sir

Thank you for your effort in finding the solution. But we cannot switch to a paid plan because there is no system that allow payment in hard currency from our location .
I think my problem would be solved if Api endpoint to access odkcenteral /formsubmission using pyODk added to white list of API for free plan.

Dear sir

for my Allow list request :
pythonanywhere require a link to the documentation on .swisstph.ch that states that they expect their site to be used as an API.