mirror of
https://github.com/Redume/Shirino.git
synced 2025-04-02 18:57:34 +03:00
fix: Fixed an error with conversion, now the correct format in the string is returned at once
This commit is contained in:
parent
f57dfd4762
commit
ecdb072773
1 changed files with 9 additions and 4 deletions
|
@ -29,18 +29,23 @@ class Converter:
|
||||||
timeout=aiohttp.ClientTimeout(total=3)
|
timeout=aiohttp.ClientTimeout(total=3)
|
||||||
) as session:
|
) as session:
|
||||||
async with session.get(
|
async with session.get(
|
||||||
f'{config['kekkai_instance']}/api/metadata'
|
f"{config['kekkai_instance']}/api/metadata"
|
||||||
) as res:
|
) as res:
|
||||||
|
|
||||||
if not HTTPStatus(res.status).is_success:
|
if not HTTPStatus(res.status).is_success:
|
||||||
return 'UTC'
|
return (
|
||||||
|
datetime.now() - timedelta(1)
|
||||||
|
).strftime('%Y-%m-%d')
|
||||||
|
|
||||||
data = await res.json()
|
data = await res.json()
|
||||||
|
|
||||||
return data.get('last_date', datetime.now() - timedelta(1))
|
return data.get(
|
||||||
|
'last_date',
|
||||||
|
(datetime.now() - timedelta(1)).strftime('%Y-%m-%d')
|
||||||
|
)
|
||||||
|
|
||||||
async def kekkai(self) -> bool:
|
async def kekkai(self) -> bool:
|
||||||
date = datetime.strftime(await self.get_lastdate(), '%Y-%m-%d')
|
date = await self.get_lastdate()
|
||||||
|
|
||||||
async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=3)) as session:
|
async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=3)) as session:
|
||||||
async with session.get(f'{config['kekkai_instance']}/api/getRate/', params={
|
async with session.get(f'{config['kekkai_instance']}/api/getRate/', params={
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue