# PythonAnywhere - Authenticated, but halts.

**URL:** <https://forum.asana.com/t/pythonanywhere-authenticated-but-halts/109626>\
**Category:** API & Developers\
**Created:** [8 February 2021 22:29 UTC](https://forum.asana.com/t/pythonanywhere-authenticated-but-halts/109626 "2021-02-08T22:29:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon34935583](https://luna1.co/8d76cd.png) [@anon34935583](https://forum.asana.com/u/anon34935583)\
**Post date:** [8 February 2021 22:29 UTC](https://forum.asana.com/t/pythonanywhere-authenticated-but-halts/109626/1 "2021-02-08T22:29:10Z")

</div>

Hi!

I’m having trouble using ASANA API on a PythonAnywhere website, this works perfectly locally, and on their python 3.7 shell.

but, when Ran on the server I can use my API key, and confirm authentication - after that it halts.

```
import asana

@action('index', method=['GET', 'POST'])
def index():
    user = auth.get_user()
    message = T("Hello {first_name}".format(**user))
    key = "MYKEY"
    asana_api = asana.Client.access_token(key)
    print("asana_api, ",asana_api)
    print(asana_api.session.authorized)
    me = asana_api.users.me() #halts on this line, or any use of the asana_api
    return dict(message=message)

```

my console logs are

2021-02-08 22:24:37 asana\_api, \<asana.client.Client object at 0x7f536c5f0750\>  
2021-02-08 22:24:37 True

and the webpage stalls until it eventually times out.

This will also time out,

```
for workspace in asana_api.workspaces.find_all():
        print ("workspace, ",workspace)
        workspace_gid = workspace.get('gid')

```

pretty much any ASANA API call except for the ones shown above will time out…

Thanks so much! Willing to provide any other necessary details

---

<div class="post-metadata">

**Author:** ![anon34935583](https://luna1.co/8d76cd.png) [@anon34935583](https://forum.asana.com/u/anon34935583)\
**Post date:** [8 February 2021 22:30 UTC](https://forum.asana.com/t/pythonanywhere-authenticated-but-halts/109626/2 "2021-02-08T22:30:52Z")

</div>

after 5 minutes or so, the logs are:

```
2021-02-08 22:24:37 asana_api, <asana.client.Client object at 0x7f536c5f0750>
2021-02-08 22:24:37 True
2021-02-08 22:29:39 Mon Feb 8 22:29:38 2021 - ***HARAKIRI ON WORKER 2 (pid: 8, try: 1)***
2021-02-08 22:29:39 Mon Feb 8 22:29:38 2021 - HARAKIRI !!! worker 2 status !!!
2021-02-08 22:29:39 Mon Feb 8 22:29:38 2021 - HARAKIRI [core 0] 10.0.0.124 - GET /simpleASANA/index since 1612823077
2021-02-08 22:29:39 Mon Feb 8 22:29:38 2021 - HARAKIRI !!! end of worker 2 status !!!
2021-02-08 22:29:39 DAMN ! worker 2 (pid: 8) died, killed by signal 9 :( trying respawn ...
2021-02-08 22:29:39 Respawned uWSGI worker 2 (new pid: 13)
2021-02-08 22:29:39 spawned 2 offload threads for uWSGI worker 2

```

---

<div class="post-metadata">

**Author:** ![anon34935583](https://luna1.co/8d76cd.png) [@anon34935583](https://forum.asana.com/u/anon34935583)\
**Post date:** [9 February 2021 18:24 UTC](https://forum.asana.com/t/pythonanywhere-authenticated-but-halts/109626/3 "2021-02-09T18:24:14Z")

</div>

This is an issue with web4py mokey-patching requests in a way that is not compatible with how we run code in web apps. We had this from Massimo DiPierro (the author of web4py):

“I tested this and if I comment gevent.monkey.patch\_all() from core.py, then pythonanywhere requests works fine for me. gevent is also a problem on google app engine and we are not using it unless we have multiple workers. For now I have eliminated this dependency and picked tornado as default.”

So if you patch your installation of web4py so that it does not call gevent.monkey\_patch\_all, it should work. Alternatively, it sounds from the above quote like Massimo may have made the change in web4py already, so maybe just updating your installation of web4py will fix it.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/asana/user_avatar/forum.asana.com/system/32/276370_2.png) [@system](https://forum.asana.com/u/system)\
**Post date:** [30 May 2025 18:57 UTC](https://forum.asana.com/t/pythonanywhere-authenticated-but-halts/109626/4 "2025-05-30T18:57:24Z")

</div>

Closed on 30 May 2025 18:57 UTC


