From 5131bd9e2753b855e01226cf1bcfc7c7331ffa3f Mon Sep 17 00:00:00 2001 From: Marek Marecki Date: Sun, 7 Jul 2013 18:24:30 +0200 Subject: [PATCH] Fixed `User()` to make use of `Search().user()` --- diaspy/people.py | 5 +++++ diaspy/search.py | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/diaspy/people.py b/diaspy/people.py index 0f0bed1..27dde8c 100644 --- a/diaspy/people.py +++ b/diaspy/people.py @@ -106,6 +106,11 @@ class User(): request = self._connection.get('people/{0}.json'.format(self.guid)) self._postproc(request) + def fetchprofile(self): + """Fetches user data. + """ + self.data = self._finalize_data(search.Search(self._connection).user(self.handle)[0]) + class Contacts(): """This class represents user's list of contacts. diff --git a/diaspy/search.py b/diaspy/search.py index 3c66ec5..4b6a1df 100644 --- a/diaspy/search.py +++ b/diaspy/search.py @@ -20,12 +20,12 @@ class Search(): request = self._connection.get('people', headers={'accept': 'text/html'}, params={'q': handle}) return request.status_code - def users(self, query): + def user(self, query): """Searches for a user. Will return list of dictionaries containing data of found users. """ - request = self._connection.get('people.json', params={'q': query, 'utf-8': ''}) + request = self._connection.get('people.json', params={'q': query, 'utf-8': '%u2713'}) if request.status_code == 200: result = request.json() else: -- 2.25.1