~didrocks/unity/altf10

« back to all changes in this revision

Viewing changes to grackle/client.py

  • Committer: Aaron Bentley
  • Date: 2012-01-16 16:42:59 UTC
  • Revision ID: aaron@canonical.com-20120116164259-qcx32bgzhabmopnc
Cleaner logging switch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
        self.netloc = '%s:%d' % (host, port)
20
20
 
21
21
    def archive_url(self, archive_id, query):
22
 
        path = '/%s' % quote(archive_id)
 
22
        path = '/archive/%s' % quote(archive_id)
23
23
        query_string = urlencode(query)
24
24
        return urlunparse(('http', self.netloc, path, '', query_string, ''))
25
25
 
44
44
            raise Exception('!!')
45
45
 
46
46
    def get_messages(self, archive_id, message_ids=None, limit=None,
47
 
                     memo=None, order=None):
 
47
                     memo=None, order=None, headers=None,
 
48
                     max_body_length=None, include_hidden=False):
48
49
        parameters = {}
49
50
        if message_ids is not None:
50
51
            parameters['message_ids'] = message_ids
54
55
            parameters['memo'] = memo
55
56
        if order is not None:
56
57
            parameters['order'] = order
 
58
        if headers is not None:
 
59
            parameters['headers'] = headers
 
60
        if max_body_length is not None:
 
61
            parameters['max_body_length'] = max_body_length
 
62
        parameters['include_hidden'] = include_hidden
57
63
        query = {'parameters': simplejson.dumps(parameters)}
58
64
        response = self._verb_archive('GET', archive_id, query)
59
65
        if response.status == httplib.BAD_REQUEST:
60
66
            raise UnsupportedOrder
61
67
        data = response.read()
62
68
        return simplejson.loads(data)
 
69