mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-01 19:31:10 +00:00
Implement License API (#734)
* Implement License API * Update copyright
This commit is contained in:
@@ -58,6 +58,7 @@ import github.PaginatedList
|
||||
import Repository
|
||||
import Installation
|
||||
import Legacy
|
||||
import License
|
||||
import github.GithubObject
|
||||
import HookDescription
|
||||
import GitignoreTemplate
|
||||
@@ -169,6 +170,35 @@ class Github(object):
|
||||
"""
|
||||
return self.__requester.oauth_scopes
|
||||
|
||||
def get_license(self, key=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `GET /license/:license <https://developer.github.com/v3/licenses/#get-an-individual-license>`_
|
||||
:param key: string
|
||||
:rtype: :class:`github.License.License`
|
||||
"""
|
||||
|
||||
assert isinstance(key, (str, unicode)), key
|
||||
headers, data = self.__requester.requestJsonAndCheck(
|
||||
"GET",
|
||||
"/licenses/" + key
|
||||
)
|
||||
return github.License.License(self.__requester, headers, data, completed=True)
|
||||
|
||||
def get_licenses(self):
|
||||
"""
|
||||
:calls: `GET /licenses <https://developer.github.com/v3/licenses/#list-all-licenses>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.License.License`
|
||||
"""
|
||||
|
||||
url_parameters = dict()
|
||||
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.License.License,
|
||||
self.__requester,
|
||||
"/licenses",
|
||||
url_parameters
|
||||
)
|
||||
|
||||
def get_user(self, login=github.GithubObject.NotSet):
|
||||
"""
|
||||
:calls: `GET /users/:user <http://developer.github.com/v3/users>`_ or `GET /user <http://developer.github.com/v3/users>`_
|
||||
|
||||
Reference in New Issue
Block a user