mirror of
https://github.com/RGBCube/GitHubWrapper
synced 2025-05-18 15:05:08 +00:00
Post objects
This commit is contained in:
parent
66486211f3
commit
36c9c6eb6d
3 changed files with 18 additions and 1 deletions
|
@ -1,11 +1,11 @@
|
|||
#== http.py ==#
|
||||
|
||||
|
||||
import aiohttp
|
||||
from collections import namedtuple
|
||||
from datetime import datetime
|
||||
from types import SimpleNamespace
|
||||
import re
|
||||
import json
|
||||
|
||||
from .exceptions import *
|
||||
from .objects import *
|
||||
|
@ -141,6 +141,16 @@ async def get_repo_issue(session: aiohttp.ClientSession, owner: str, repo_name:
|
|||
return Issue(await result.json(), session)
|
||||
raise IssueNotFound
|
||||
|
||||
async def make_repo(session: aiohttp.ClientSession, name: str) -> Repository:
|
||||
"""Creates a new repo with the given name."""
|
||||
_data = {"name" : name}
|
||||
try:
|
||||
result = await session.post(MAKE_REPO_URL, data= json.dumps(_data))
|
||||
if result.status == 201:
|
||||
return Repository(await result.json(), session)
|
||||
except Exception:
|
||||
print(Exception)
|
||||
|
||||
# org-related functions / utils
|
||||
|
||||
async def get_org(session: aiohttp.ClientSession, org_name: str) -> Organization:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue