get_mailbox() refactored to use _sessionget()
authorMarek Marecki <triviuss@gmail.com>
Fri, 29 Mar 2013 11:16:45 +0000 (12:16 +0100)
committerMarek Marecki <triviuss@gmail.com>
Fri, 29 Mar 2013 11:16:45 +0000 (12:16 +0100)
diaspy/client.py

index 556935931d12a8e4ecc88bb9d575e41588408150..bf3ddd915ce60dcd7b7157d5bb32819d7f044d83 100644 (file)
@@ -279,16 +279,13 @@ class Client:
         :returns: list -- list of Conversation objects.
         """
         data = {'authenticity_token': self.get_token()}
-        #r = self.session.get('{0}/conversations.json'.format(self.pod))
-        r = self.session.get('{0}/conversations.json'.format(self.pod))
+        r = self._sessionget('conversations.json')
 
         if r.status_code != 200:
             raise Exception('wrong status code: {0}'.format(r.status_code))
 
         mailbox = r.json()
-        conversations = [ diaspy.conversations.Conversation(str(conversation['conversation']['id']), self) for conversation in mailbox ]
-
-        return conversations
+        return [ diaspy.conversations.Conversation(str(conversation['conversation']['id']), self) for conversation in mailbox ]
 
     def new_conversation(self, contacts, subject, text):
         """ start a new conversation