From 6daefb49e72d04fa7d62ad41f5457b92561d2cab Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 1 Aug 2009 16:17:39 +0200 Subject: [PATCH] working google auth --- __init__.py | 0 reader.py | 29 +++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 __init__.py create mode 100644 reader.py diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/reader.py b/reader.py new file mode 100644 index 0000000..c9e468d --- /dev/null +++ b/reader.py @@ -0,0 +1,29 @@ +# +# class to authenticate to google and get items from +# google reader +# +# +import urllib +import urllib2 +import re + +class GoogleReader: + ''' class for connecting to google''' + def __init__(self, login, password): + self.login = login + self.password = password + self.authurl = "https://www.google.com/accounts/ClientLogin" + self.sid = "" + self.re_username = re.compile("Auth=") + + def authenticate(self,login,password): + ''' method to authenticate to google''' + parameters = {'Email' : login,'Passwd' : password,'accountType' : 'HOSTED_OR_GOOGLE', + 'service' : 'reader', 'source' : 'googlereader2instapaper' } + headerdata = urllib.urlencode(parameters) + try: + request = urllib2.Request(self.authurl, headerdata) + response = urllib2.urlopen(request).read() + return response + except IOError, e: + return -1 \ No newline at end of file