jorrebor
jorrebor

Reputation: 2232

How to use urllib2 when users only have a API token?

how would i tranfoms this curl command:

curl -v -u 82xxxxxxxxxxxx63e6:api_token -X GET https://www.toggl.com/api/v6/time_entries.json

into urlib2?

I found this tutorial: http://www.voidspace.org.uk/python/articles/authentication.shtml

but they use a password and username. I can only use an API token.

Thank you.

see also this question:

Urllib2 raises 403 error while the same request in curl works fine

Upvotes: 0

Views: 1919

Answers (1)

skrat
skrat

Reputation: 5562

urllib2 is known to suck big time when it comes to authentication. To save some kitten lifes you should use http://docs.python-requests.org/en/latest/index.html

Upvotes: 1

Related Questions