Created
April 4, 2014 00:12
-
-
Save tstachl/9965457 to your computer and use it in GitHub Desktop.
RAuth example with desk.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rauth import OAuth1Session | |
import pprint | |
try: | |
read_input = raw_input | |
except NameError: | |
read_input = input | |
session = OAuth1Session('YOUR_CONSUMER_KEY', | |
'YOUR_CONSUMER_SECRET', | |
access_token='YOUR_ACCESS_TOKEN', | |
access_token_secret='YOUR_ACCESS_TOKEN_SECRET') | |
tickets = session.get('https://YOURSUBDOMAIN.desk.com/api/v2/cases', verify=True) | |
for i, ticket in enumerate(tickets.json()['_embedded']['entries'], 1): | |
subject = ticket['subject'] | |
blurb = ticket['blurb'] | |
print(u'{0}. {1} - {2}'.format(i, subject, blurb)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment