Permalink
Browse files

Implement cookie support

  • Loading branch information...
jarun committed Jun 9, 2016
1 parent 3a9814a commit 870217a2fefda6b12e07fa078adb3475c29f71be
Showing with 6 additions and 0 deletions.
  1. +6 −0 googler
View
@@ -501,6 +501,7 @@ class GoogleConnection(object):
self._proxy = proxy
self._conn = None
self.new_connection(host, port=port, timeout=timeout)
self.cookie = ''
@property
def host(self):
@@ -666,8 +667,13 @@ class GoogleConnection(object):
self._conn.request('GET', url, None, {
'Accept-Encoding': 'gzip',
'User-Agent': USER_AGENT,
'Cookie': self.cookie,
})
self._resp = self._conn.getresponse()
if self.cookie == '':
complete_cookie = self._resp.getheader('Set-Cookie')
self.cookie = complete_cookie[:complete_cookie.find(';')]
logger.debug('Cookie: %s' % self.cookie)
def close(self):
"""Close the connection (if one is active)."""

0 comments on commit 870217a

Please sign in to comment.