~didrocks/unity/altf10

« back to all changes in this revision

Viewing changes to grackle/client.py

  • Committer: Aaron Bentley
  • Date: 2012-01-11 11:36:08 UTC
  • Revision ID: aaron@canonical.com-20120111113608-fgygml5scw5orr0j
Use pipe to ensure we only use HTTP once it's running.

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_string = urlencode(query)
21
 
        return urlunparse(('http', self.netloc, path, '', query_string, ''))
 
20
        query = urlencode(query)
 
21
        url = urlunparse(('http', self.netloc, path, '', '', ''))
22
22
 
23
23
    def _get_connection(self):
 
24
        print 'Connecting to %s' % self.port
24
25
        return httplib.HTTPConnection(self.host, self.port)
25
26
 
26
27
    def _verb_archive(self, verb, archive_name, query, body=None):
43
44
    def get_messages(self, archive_name, message_ids=None):
44
45
        parameters = {}
45
46
        if message_ids is not None:
46
 
            parameters['message_ids'] = message_ids
 
47
            parameters[message_ids] = message_ids
47
48
        query = {'parameters': simplejson.dumps(parameters)}
48
49
        response = self._verb_archive('GET', archive_name, query)
49
 
        data = response.read()
50
 
        return simplejson.loads(data)
 
50
        return {}