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

Third times a charm

This commit is contained in:
sudosnok 2022-03-27 14:58:25 +01:00
parent 6797dc8a4f
commit 153e1e50d4

View file

@ -8,7 +8,7 @@ from getpass import getpass
import aiohttp import aiohttp
import http import http
from exceptions import AlreadyStarted, NotStarted import exceptions
from objects import User, Repository from objects import User, Repository
class Github: class Github:
@ -35,7 +35,7 @@ class Github:
def check_limits(self, as_dict: bool = False) -> dict[str, str | int] | list[str]: def check_limits(self, as_dict: bool = False) -> dict[str, str | int] | list[str]:
if not self.has_started: if not self.has_started:
raise NotStarted raise exceptions.NotStarted
if not as_dict: if not as_dict:
output = [] output = []
for key, value in self.session._rates._asdict().items(): for key, value in self.session._rates._asdict().items():
@ -52,7 +52,7 @@ class Github:
async def start(self) -> None: async def start(self) -> None:
"""Main entry point to the wrapper, this creates the ClientSession.""" """Main entry point to the wrapper, this creates the ClientSession."""
if self.has_started: if self.has_started:
raise AlreadyStarted raise exceptions.AlreadyStarted
self.session = await http.make_session(headers=self._headers, authorization=self._auth) self.session = await http.make_session(headers=self._headers, authorization=self._auth)
self.has_started = True self.has_started = True
return self return self