Skip to content
Browse files

updated to new auth mechanism.

  • Loading branch information...
1 parent 4400ac0 commit 2fbbcbc642d24a5286fead6112c1f6a9722bc1fe @timbertson committed
Showing with 9 additions and 3 deletions.
  1. +2 −3 src/sync/lib/GoogleReader/reader.py
  2. +7 −0 src/sync/lib/GoogleReader/web/web.py
View
5 src/sync/lib/GoogleReader/reader.py
@@ -56,14 +56,13 @@ def login(self) :
# print sidinfo
self._sid = None
- SID_ID = 'SID='
+ SID_ID = 'Auth='
if SID_ID in sidinfo :
pos_beg = sidinfo.find(SID_ID)
pos_end = sidinfo.find('\n',pos_beg)
self._sid = sidinfo[pos_beg+len(SID_ID):pos_end]
if self._sid != None :
- cookie = cookielib.Cookie(version=0, name='SID', value=self._sid, port=None, port_specified=False, domain='.google.com', domain_specified=True, domain_initial_dot=True, path='/', path_specified=True, secure=False, expires='1600000000', discard=False, comment=None, comment_url=None, rest={})
- self._web.cookies().set_cookie(cookie)
+ self._web.set_auth(self._sid)
return True
View
7 src/sync/lib/GoogleReader/web/web.py
@@ -58,6 +58,7 @@ def cookies(self) :
class webUrllib2 :
def __init__( self, agent = DEFAULT_AGENT, http_proxy=None ) :
+ self.auth = None
self._agent = agent
openers = []
@@ -76,6 +77,9 @@ def __init__( self, agent = DEFAULT_AGENT, http_proxy=None ) :
opener = urllib2.build_opener(*openers)
urllib2.install_opener(opener)
+
+ def set_auth(self, auth):
+ self.auth = auth
def get ( self, url, postargs=None, file=None, encoding='utf-8', cookie=None ) :
result = ""
@@ -90,12 +94,15 @@ def get ( self, url, postargs=None, file=None, encoding='utf-8', cookie=None ) :
header = {'User-agent' : self._agent}
if cookie :
header['Cookie']=cookie
+ if self.auth:
+ header['Authorization']="GoogleLogin auth=%s" % (self.auth,)
#print self._cookiejar
#print url
request = urllib2.Request(url, postdata, header)
#print "[ %s ]" % self._cookiejar._cookies_for_request(request)
+ # print repr(header)
self._cookiejar.add_cookie_header(request)
f = urllib2.urlopen( request )

0 comments on commit 2fbbcbc

Please sign in to comment.
Something went wrong with that request. Please try again.