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

Moved objects into their own place in a folder for readability

This commit is contained in:
sudosnok 2022-03-27 13:04:00 +01:00
parent 9a2889702b
commit d5ba5bc58d
6 changed files with 93 additions and 73 deletions

29
Github/objects/objects.py Normal file
View file

@ -0,0 +1,29 @@
#== objects.py ==#
from datetime import datetime
import aiohttp
__all__ = (
'APIOBJECT',
)
def dt_formatter(time_str):
if time_str is not None:
return datetime.strptime(time_str, r"%Y-%m-%dT%H:%M:%SZ")
return None
def repr_dt(time_str):
return time_str.strftime(r'%d-%m-%Y, %H:%M:%S')
class APIOBJECT:
__slots__ = (
'_response',
'session'
)
def __init__(self, response: dict[str, str | int], session: aiohttp.ClientSession) -> None:
self._response = response
self.session = session
def __repr__(self) -> str:
return f'<{self.__class__.__name__}>'