Browse Source

Logged user information.

master
Julio Biason 15 years ago
parent
commit
f53cb56a37
  1. 9
      mitterlib/network/__init__.py
  2. 7
      mitterlib/network/twitter.py

9
mitterlib/network/__init__.py

@ -100,7 +100,14 @@ class Networks(object):
return self._networks
def _targets(self, shortcut):
def user(self, network=None):
"""Return a :class:`NetworkUser` representation for the logged user in
the requested network. If no network is selected, will return the
first found."""
shortcut = self._targets(network).next() # need this due yield
return self.networks[shortcut].user
def _targets(self, shortcut=None):
"""Select a network based on the shortcut. If the shortcut is None,
returns all available network shortcuts."""
if shortcut:

7
mitterlib/network/twitter.py

@ -192,7 +192,12 @@ class Connection(NetworkBase):
return self._user
user = self._request('/account/verify_credentials.json')
self._user = TwitterNetworkUser(user)
self._user = NetworkUser()
self._user.name = user['name']
self._user.username = user['screen_name']
self._user.avatar = user['profile_image_url']
_log.debug("User: %s" % (self._user))
return self._user

Loading…
Cancel
Save