I use my Google Reader notes as a place to store bookmarks and small snippets of information. I would like to write a small script to let me post notes from the command line (I prefer Python,but an answer using any language will be accepted).
This project seemed to be a be a good place to start & some more up-to-date information here. The process appears to be:
- Get a SID (session ID) from https://www.google.com/accounts/ClientLogin?service=reader&Email={0}&Passwd={1}
- Get a temporary token from http://www.google.com/reader/api/0/token
- Make a POST to http://www.google.com/reader/api/0/item/edit with the correct field values
So... step 2 above always fails for me (get a 403 forbidden) and trying Martin Doms C# code has the same issue. It looks like Google no longer use this method for authentication.
Update... This comment got me up and running. I can now log in and get a token. Now I just need to figure out how to POST the note. My code is below:
import urllib2
# Step 1: login to get session auth
email = 'myuser@gmail.com'
passwd = 'mypassword'
response = urllib2.urlopen('https://www.google.com/accounts/ClientLogin?service=reader&Email=%s&Passwd=%s' % (email,passwd))
data = response.read()
credentials = {}
for line in data.split('\n'):
fields = line.split('=')
if len(fields)==2:
credentials[fields[0]]=fields[1]
assert credentials.has_key('Auth'),'no Auth in response'
# step 2: get a token
req = urllib2.Request('http://www.google.com/reader/api/0/token')
req.add_header('Authorization', 'GoogleLogin auth=%s' % credentials['Auth'])
response = urllib2.urlopen(req)
# step 3: now POST the details of note
# TBD...