ForumsDevelopersPython OAuth Example


Python OAuth Example
Author Message
notprivategabe

Posted: Jan 23, 2016
Score: 0 Reference
Hi Folks,

I'm posting a sanitized version of a python oriented oauth script I made for others who want to use python for their authorization. You do not need to handle callbacks appropriately, just copy the auth code from the broken URL. It uses requests_oauthlib and requests module; it then pickles the full token once generated for later use (including refreshes). You can view it here:

https://gist.github.com/gadeleon/ba9be09e42ed2053f23a

Running the script is simple, write in your client details, secret, and whatever you registered as the redirect URI ( http://localhost is probably the easiest. Using python python_oauth_example.py --new-token will take you through the authorization and auth code process. Using --refresh-token will simply renew the token.

Last week I was trying to get a python oriented CLI program up and running. I'm not a sophisticated programmer by any means so Toodledo's lack of python oauth examples meant I had to go digging. Since it's CLI, I'm also not interested in trying to appropriately handle the callback/redirect and Toodledo doesn't support urn:ietf:wg:oauth:2.0:oob which would have made things a lot easier.

Enjoy, I hope this saves people some time!


This message was edited Jan 23, 2016.
Jake

Toodledo Admin
Posted: Jan 25, 2016
Score: 0 Reference
This is great. Thanks!
You cannot reply yet

U Back to topic home

R Post a reply

To participate in these forums, you must be signed in.