Return Post object instead of json
authorMoritz Kiefer <moritz.kiefer@gmail.com>
Sat, 2 Feb 2013 11:22:48 +0000 (12:22 +0100)
committerMoritz Kiefer <moritz.kiefer@gmail.com>
Sat, 2 Feb 2013 11:22:48 +0000 (12:22 +0100)
diaspy/__init__.py
diaspy/client.py

index 9759425e7a4e35c327fa852807322b8515ae6329..f10e2315eb6f4b22e7210a207d926cc5e7b286e8 100644 (file)
@@ -1,2 +1,2 @@
-import client
-import models
+import diaspy.client
+import diaspy.models
index e8c16ce32f324a346e5a32d0ef3a82f386753d59..0d43ef4440413d70f7b062c526d16e3698850c57 100644 (file)
@@ -1,7 +1,7 @@
 import requests
 import re
 import json
-import models
+import diaspy.models
 
 
 class Client:
@@ -66,6 +66,8 @@ class Client:
         :param aspect_id: Aspect id to send post to.
         :type aspect_id: str
 
+        :returns: diaspy.models.Post -- the Post which has been created
+
         """
         data = {'aspect_ids': aspect_id,
                 'status_message[text]': text,
@@ -77,7 +79,7 @@ class Client:
         if r.status_code != 201:
             raise Exception(str(r.status_code) + ': Post could not be posted.')
 
-        return r.json()
+        return diaspy.models.Post(str(r.json()['id']), self)
 
     def get_user_info(self):
         """This function returns the current user's attributes.