1
Fork 0
mirror of https://github.com/RGBCube/GitHubWrapper synced 2025-05-18 15:05:08 +00:00

Adding fetching orgs

This commit is contained in:
VarMonke 2022-03-29 19:42:29 +05:30
parent 6c8e5cec0e
commit 45db6d5120
4 changed files with 23 additions and 5 deletions

View file

@ -21,7 +21,7 @@ class Organization(APIOBJECT):
'followers',
'following',
'created_at',
#will add
'avatar_url',
)
def __init__(self, response: dict, session: aiohttp.ClientSession) -> None:
@ -43,3 +43,10 @@ class Organization(APIOBJECT):
def __repr__(self):
return f'<Organization; login: {self.login}, id: {self.id}, html_url: {self.html_url}, is_verified: {self.is_verified}, public_repos: {self.public_repos}, public_gists: {self.public_gists}, created_at: {self.created_at}>'
@classmethod
async def from_name(cls, session: aiohttp.ClientSession, org: str) -> 'Organization':
"""Fetch a repository from its name."""
response = await http.get_repo_from_name(session, org)
return Organization(response, session)