-
-
Save seanieb/6983332 to your computer and use it in GitHub Desktop.
This file contains 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 __future__ import unicode_literals | |
from urlparse import parse_qs | |
import requests | |
from requests_oauthlib import OAuth1 | |
key = "key" | |
secret ="secret" | |
oauth = OAuth1(key, secret) | |
instaaccount = "username" | |
instapassword = "password" | |
params = {} | |
params["x_auth_username"] = instaaccount | |
params["x_auth_password"] = instapassword | |
params["x_auth_mode"] = 'client_auth' | |
request_token_url = 'https://www.instapaper.com/api/1/oauth/access_token' | |
r = requests.post(url=request_token_url, auth=oauth, data=params) | |
credentials = parse_qs(r.content) | |
oauth_token = credentials.get('oauth_token')[0] | |
oauth_secret = credentials.get('oauth_token_secret')[0] | |
oauth = OAuth1(key, secret+"&"+oauth_secret, oauth_token) | |
list_url = 'https://www.instapaper.com/api/1/bookmarks/list' | |
params = { | |
"username": instaaccount, | |
"password": instapassword | |
} | |
r = requests.post(list_url, auth=oauth, data=params) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment