Skip to content

Instantly share code, notes, and snippets.

@nellynette
Created November 26, 2013 21:43
Show Gist options
  • Save nellynette/7666795 to your computer and use it in GitHub Desktop.
Save nellynette/7666795 to your computer and use it in GitHub Desktop.
#!/usr/local/bin/python
import requests
import re
import keychain
########
# Configure these settings
username = 'you@email.com'
mypass = keychain.get_password('instapaper', username)
# End configure these settings
########
s = requests.Session()
login_url = 'http://www.instapaper.com/user/login'
payload = {'username': username, 'password': mypass}
s.post(login_url, data=payload)
user_url = 'http://www.instapaper.com/user'
send_url = 'http://www.instapaper.com/user/kindle_send_now'
get_form_key = s.get(user_url).content
form_key = re.search(r'<input type="hidden" id="form_key_send_now" name="form_key" value="([a-zA-Z0-9]+)"/>', get_form_key).group(1)
send_params = {'form_key': form_key}
s.post(send_url, data=send_params)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment