From: Marek Marecki Date: Thu, 23 May 2013 05:19:50 +0000 (+0200) Subject: Add more documentation for diaspy.people.User() X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c5d935c0b3e957ab95ee3f1ca06df5a4a5a7123f;p=diaspy.git Add more documentation for diaspy.people.User() --- diff --git a/diaspy/people.py b/diaspy/people.py index 20e770a..1c33ee6 100644 --- a/diaspy/people.py +++ b/diaspy/people.py @@ -8,6 +8,11 @@ class User: extract user data using black magic. However, no chickens are harmed when you use it. + If user has not posted yet diaspy will not be able to extract the information + from his/her posts. Since there is no official way to do it we rely + on user posts. If this will be the case user will be notified with appropriate + exception message. + When creating new User() one can pass either guid or handle as an optional parameter. GUID takes precedence over handle. """ @@ -48,7 +53,10 @@ class User: raise Exception('wrong error code: {0}'.format(request.status_code)) else: request = request.json() - data, final = request[0]['author'], {} + + if not len(request): raise ('Cannot extract user data: no posts to analyze') + data = request[0]['author'] + final = {} names = [('id', 'id'), ('diaspora_id', 'diaspora_id'), ('guid', 'guid'),