Created
July 24, 2013 04:11
-
-
Save n8henrie/6068015 to your computer and use it in GitHub Desktop.
Manually trigger Instapaper to send your unread queue to your Kindle (assuming you have your settings set up at Instapaper.com).
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
#!/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