mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-02 03:41:08 +00:00
Added a method for getting a user by their id (#1691)
* Added a method for getting a user by their id * Added get_user_by_id to MainClass stubs Fixes #1615
This commit is contained in:
@@ -275,6 +275,20 @@ class Github(object):
|
||||
self.__requester, headers, data, completed=True
|
||||
)
|
||||
|
||||
def get_user_by_id(self, user_id):
|
||||
"""
|
||||
:calls: `GET /user/:id <http://developer.github.com/v3/users>`_
|
||||
:param user_id: int
|
||||
:rtype: :class:`github.NamedUser.NamedUser`
|
||||
"""
|
||||
assert isinstance(user_id, int), user_id
|
||||
headers, data = self.__requester.requestJsonAndCheck(
|
||||
"GET", "/user/" + str(user_id)
|
||||
)
|
||||
return github.NamedUser.NamedUser(
|
||||
self.__requester, headers, data, completed=True
|
||||
)
|
||||
|
||||
def get_users(self, since=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `GET /users <http://developer.github.com/v3/users>`_
|
||||
|
||||
Reference in New Issue
Block a user