~didrocks/unity/altf10

« back to all changes in this revision

Viewing changes to grackle/client.py

  • Committer: Aaron Bentley
  • Date: 2012-01-11 15:44:02 UTC
  • Revision ID: aaron@canonical.com-20120111154402-qi5nk23wwd7czvrj
Include next_memo, previous_memo in get_messages response.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
    def archive_url(self, archive_name, query):
19
19
        path = '/%s' % quote(archive_name)
20
 
        query = urlencode(query)
21
 
        url = urlunparse(('http', self.netloc, path, '', '', ''))
 
20
        query_string = urlencode(query)
 
21
        return urlunparse(('http', self.netloc, path, '', query_string, ''))
22
22
 
23
23
    def _get_connection(self):
24
 
        print 'Connecting to %s' % self.port
25
24
        return httplib.HTTPConnection(self.host, self.port)
26
25
 
27
26
    def _verb_archive(self, verb, archive_name, query, body=None):
44
43
    def get_messages(self, archive_name, message_ids=None):
45
44
        parameters = {}
46
45
        if message_ids is not None:
47
 
            parameters[message_ids] = message_ids
 
46
            parameters['message_ids'] = message_ids
48
47
        query = {'parameters': simplejson.dumps(parameters)}
49
48
        response = self._verb_archive('GET', archive_name, query)
50
 
        return {}
 
49
        data = response.read()
 
50
        return simplejson.loads(data)