Python API Connection Problems

Good Day Fellows,
i am trying to connect to Asana via the python library. The problem is that i can’t do the simplest hello world and my question is, do i have to add any more credentials? From the example code this should work without anyting.
The url request in the browser works, but not the python request

client = asana.Client.access_token(personal_access_token)
me = client.users.me()

Error:
Traceback (most recent call last):
File “C:\Python_installation\lib\site-packages\urllib3\connection.py”, line 159, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw)
File “C:\Python_installation\lib\site-packages\urllib3\util\connection.py”, line 80, in create_connection
raise err
File “C:\Python_installation\lib\site-packages\urllib3\util\connection.py”, line 70, in create_connection
sock.connect(sa)
TimeoutError: [WinError 10060]

That is weird because the errors don’t even come from the Asana package…

I would guess, that this has something to do with the authentication System, but i could not figure out what is going on.

requests.exceptions.ConnectionError: HTTPSConnectionPool(host=‘app.asana.com’, port=443): Max retries exceeded with url: /-/oauth_token (Caused by NewConnectionError(’<urllib3.connection.VerifiedHTTPSConnection object at 0x04DFC9B0>: Failed to establish a new connection: [WinError 10060] Ein Verbindungsversuch ist fehlgeschlagen, da die Gegenstelle nach einer bestimmten Zeitspanne nicht richtig reagiert hat, oder die hergestellte Verbindung war fehlerhaft, da der verbundene Host nicht reagiert hat’))

You did follow the instructions on the library page? :thinking::man_shrugging:

I did. The SSL version is certainly higher than the required. I also checked every dependency

I am lost honestly. @Phil_Seeman be the hero we need.

I appreciate the shout out @Bastien_Siebman but I’m afraid I’m not up on the Python library. It sounds like it’s something specific to that library, since @Andreas_Rist says it works in the browser.

@Ross_Grambo, maybe you can help?

Hey @Andreas_Rist,

I’m sad to say I don’t think I’ll be much help yet, I’m not able to reproduce this. Could you try running it in pipenv? I’m curious if it’s something specific to your machine’s installed packages.

Problem solved: The company proxyserver is blocking the connection to asana Webserver, as it is outside of the comanpy network.

Still thank you all!

2 Likes