diff options
| author | 2012-03-01 13:12:00 +0100 | |
|---|---|---|
| committer | 2012-03-01 13:12:00 +0100 | |
| commit | 397238b404a66ba25aec1e4d7902e16104eddefc (patch) | |
| tree | 7453341e1e3257282cf5d87285b451b6fc13ec23 /pygithub3/services/users/__init__.py | |
| parent | Services.repos.Repo doc (diff) | |
| download | python-github3-397238b404a66ba25aec1e4d7902e16104eddefc.tar.xz python-github3-397238b404a66ba25aec1e4d7902e16104eddefc.zip | |
Restructure modules and packages in a clean way
The docs has increased lines of code, so I split it
Diffstat (limited to '')
| -rw-r--r-- | pygithub3/services/users/__init__.py | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/pygithub3/services/users/__init__.py b/pygithub3/services/users/__init__.py new file mode 100644 index 0000000..c448319 --- /dev/null +++ b/pygithub3/services/users/__init__.py @@ -0,0 +1,49 @@ +#!/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) |
