From 95d2d3106f4592b6160f372efa5c4d638a0bcebd Mon Sep 17 00:00:00 2001 From: Moritz Kiefer Date: Sat, 2 Feb 2013 12:22:48 +0100 Subject: [PATCH] Return Post object instead of json --- diaspy/__init__.py | 4 ++-- diaspy/client.py | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/diaspy/__init__.py b/diaspy/__init__.py index 9759425..f10e231 100644 --- a/diaspy/__init__.py +++ b/diaspy/__init__.py @@ -1,2 +1,2 @@ -import client -import models +import diaspy.client +import diaspy.models diff --git a/diaspy/client.py b/diaspy/client.py index e8c16ce..0d43ef4 100644 --- a/diaspy/client.py +++ b/diaspy/client.py @@ -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. -- 2.25.1