return self['guid']
def __repr__(self):
- return '{0} ({1})'.format(self['diaspora_name'], self['guid'])
+ return '{0} ({1})'.format(self['handle'], self['guid'])
def _fetchstream(self):
self.stream = Outer(self._connection, location='people/{0}.json'.format(self['guid']))
def fetchprofile(self):
"""Fetches user data.
"""
- data = search.Search(self._connection).user(self['handle'])[0]
- self.data = data
+ result = search.Search(self._connection).user(self['handle'])
+
+ # Check if there were any results at all
+ if len(result) < 1:
+ raise errors.UserError('could not fetch profile of user: {0}'.format(self['handle']))
+
+ self.data = result[0]
def getHCard(self):
"""Returns XML string containing user HCard.
def getInfo(self):
"""This function returns the current user's attributes.
- :returns: dict -- json formatted user info.
+ :returns: dict
"""
request = self._connection.get('bookmarklet')
userdata = self._userinfo_regex.search(request.text)