mirror of
https://github.com/RGBCube/GitHubWrapper
synced 2025-05-18 15:05:08 +00:00
Erroring
This commit is contained in:
parent
ed9c8ceee8
commit
c39e4c1ed6
5 changed files with 42 additions and 9 deletions
|
@ -15,6 +15,7 @@ __all__ = (
|
|||
'make_session',
|
||||
'Paginator',
|
||||
'get_user',
|
||||
'get_repo_from_name',
|
||||
)
|
||||
|
||||
|
||||
|
@ -117,4 +118,14 @@ async def get_user(session: aiohttp.ClientSession, username: str) -> GitHubUserD
|
|||
result = await session.get(USERS_URL.format(username))
|
||||
if result.status == 200:
|
||||
return await result.json()
|
||||
raise UserNotFound
|
||||
raise UserNotFound
|
||||
|
||||
|
||||
# repo-related functions / utils
|
||||
|
||||
async def get_repo_from_name(session: aiohttp.ClientSession, owner: str, repo_name: str):
|
||||
"""Returns a Repo object from the given owner and repo name."""
|
||||
result = await session.get(REPO_URL.format(owner, repo_name))
|
||||
if result.status == 200:
|
||||
return await result.json()
|
||||
raise RepositoryNotFound
|
Loading…
Add table
Add a link
Reference in a new issue