Skip to content

Instantly share code, notes, and snippets.

@nolastan
Created September 10, 2012 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nolastan/3691669 to your computer and use it in GitHub Desktop.
Save nolastan/3691669 to your computer and use it in GitHub Desktop.
tr_python
# Use the py_oauth2 library
# https://github.com/liluo/py-oauth2
from py_oauth2 import oauth2
task_rabbit_client = oauth2.Client(TASK_RABBIT_KEY, TASK_RABBIT_SECRET,
site='https://taskrabbitdev.com',
authorize_url='https://taskrabbitdev.com/api/authorize',
token_url='https://taskrabbitdev.com/api/oauth/token',
header_format= 'OAuth %s')
task_rabbit_access = oauth2.AccessToken(client=task_rabbit_client, token=TASK_RABBIT_ACCESS_TOKEN, header_format= 'OAuth %s')
# make requests like:
hdrs= {'X-Client-Application': TASK_RABBIT_SECRET}
task_rabbit_access.get('/api/v1/tasks', headers=hdrs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment