Created
June 2, 2011 14:15
-
-
Save mdeous/1004527 to your computer and use it in GitHub Desktop.
scoopy usage sample
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
| import os | |
| import webbrowser | |
| token_file = 'token.pickle' # optional | |
| api = ScoopItAPI( | |
| 'consumer key', | |
| 'consumer secret' | |
| ) | |
| if os.path.exists(token_file): | |
| api.load_oauth_token(token_file) #optional | |
| else: | |
| # get OAuth access token | |
| api.get_oauth_request_token() | |
| # send the user to scoop.it app authorization page (and get the verifier in the query made to redirect page) | |
| webbrowser.open(api.get_oauth_access_token_url('http://localhost')) | |
| api.get_oauth_access_token(raw_input('Verifier: ')) | |
| api.save_oauth_token(token_file) # optional | |
| profile = api.get_profile() | |
| for topic in profile.curatedTopics: | |
| print "Topic: ", topic.name | |
| print "> ", topic.description | |
| for post in topic.curatedTopics: | |
| print " Post: ", post.title | |
| print " > ", post.content |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment