`Connection()` object works, `diaply/client.py` partialy ported
[diaspy.git] / diaspy / conversations.py
index 9417a8e603504917a974ae1cf17e5fcfc3797230..631f77e5e9e5ddf3ef8695b895b512b9cbd3eb05 100644 (file)
@@ -44,12 +44,12 @@ class Conversation:
                 'utf8': '✓',
                 'authenticity_token': self._client.get_token()}
 
-        r = self._client.session.post('{0}/conversations/{1}/messages'.format(self._client.pod, self.conv_id),
+        r = self._client._sessionpost('conversations/{}/messages'.format(self.conv_id),
                                       data=data,
                                       headers={'accept': 'application/json'})
         if r.status_code != 200:
-            raise Exception('{0}: Answer could not be posted.'.format(r.status_code))
-
+            raise Exception('{0}: Answer could not be posted.'
+                            .format(r.status_code))
         return r.json()
 
     def delete(self):
@@ -58,12 +58,14 @@ class Conversation:
         """
         data = {'authenticity_token': self._client.get_token()}
 
-        r = self._client.session.delete('{0}/conversations/{1}/visibility/'.format(self._client.pod, self.conv_id),
+        r = self._client._sessiondelete('conversations/{0}/visibility/'
+                                        .format(self.conv_id),
                                         data=data,
                                         headers={'accept': 'application/json'})
 
         if r.status_code != 404:
-            raise Exception('{0}: Conversation could not be deleted.'.format(r.status_code))
+            raise Exception('{0}: Conversation could not be deleted.'
+                            .format(r.status_code))
 
     def get_subject(self):
         """ return the subject of this conversation