mirror of
https://github.com/RGBCube/GitHubWrapper
synced 2025-05-31 04:58:12 +00:00
Started the cache hopefully
This commit is contained in:
parent
fe977277be
commit
59001b7153
6 changed files with 253 additions and 0 deletions
29
Github/objetcts/objects.py
Normal file
29
Github/objetcts/objects.py
Normal 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__}>'
|
Loading…
Add table
Add a link
Reference in a new issue