Skip to content

Instantly share code, notes, and snippets.

@gipi

gipi/README.md

Last active Apr 25, 2017
Embed
What would you like to do?
#oauth #authorization
#!/usr/bin/env python2
from requests_oauthlib import OAuth2Session
client_id = 'LZAzNepabqtyGblg6uGhqiknaiDxX0LwTfYa0ZHr'
client_secret = '0icSnXkmyBQlZ93hBhj6dkI3DrKEyF5sXTqChkExQ9UxptQVqyAMOrLYc652OD7FRRSzSK2Jkb1q7HfA44adyftTzSD0cKBh1hfbQY4OtbK6bDVRcSLcsWNyiTMD8oxP'
redirect_uri = 'https://django-oauth-toolkit.herokuapp.com/consumer/exchange/'
oauth = OAuth2Session(client_id, redirect_uri=redirect_uri,)
#scope=scope)
authorization_url, state = oauth.authorization_url('https://localhost:8000/o/authorize')
print 'Please go to %s and authorize access.' % authorization_url
authorization_response = raw_input('Enter the full callback URL ')
token = oauth.fetch_token(
'https://localhost:8000/o/token/',
authorization_response=authorization_response,
client_secret=client_secret,
verify=False)
r = oauth.get('https://localhost:8000/api/v2/housedraft/?p=1')
print r.content
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.