diff options
| author | 2012-03-01 19:57:59 +0100 | |
|---|---|---|
| committer | 2012-03-01 19:57:59 +0100 | |
| commit | b891dfb211f9a58e5d834ccd148943286c45f61c (patch) | |
| tree | c90ab9489c5217151c1f1c716aea8fa39b303393 /pygithub3/services/users/__init__.py | |
| parent | Repos.watchers service done (diff) | |
| parent | Complete services.repos doc (diff) | |
| download | python-github3-b891dfb211f9a58e5d834ccd148943286c45f61c.tar.xz python-github3-b891dfb211f9a58e5d834ccd148943286c45f61c.zip | |
Merge branch 'docs'
Diffstat (limited to 'pygithub3/services/users/__init__.py')
| -rw-r--r-- | pygithub3/services/users/__init__.py | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/pygithub3/services/users/__init__.py b/pygithub3/services/users/__init__.py new file mode 100644 index 0000000..29a8e1c --- /dev/null +++ b/pygithub3/services/users/__init__.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python +# -*- encoding: utf-8 -*- + +from ..base import Service +from .keys import Keys +from .emails import Emails +from .followers import Followers + + +class User(Service): + """ Consume `Users API <http://developer.github.com/v3/users>`_ """ + + def __init__(self, **config): + self.keys = Keys(**config) + self.emails = Emails(**config) + self.followers = Followers(**config) + super(User, self).__init__(**config) + + def get(self, user=None): + """ Get a single user + + :param str user: Username + + If you call it without user and you are authenticated, get the + authenticated user. + + .. warning:: + If you aren't authenticated and call without user, it returns 403 + + :: + + user_service.get('copitux') + user_service.get() + """ + request = self.make_request('users.get', user=user) + return self._get(request) + + def update(self, data): + """ Update the authenticated user + + :param dict data: Input to update + + :: + + user_service.update(dict(name='new_name', bio='new_bio')) + """ + request = self.make_request('users.update', body=data) + return self._patch(request) |
