From 83355a6f41298313c7b778f3d1076e4d43ae2757 Mon Sep 17 00:00:00 2001 From: Redume Date: Fri, 27 Sep 2024 18:03:53 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A4=D0=B8=D0=BA=D1=81,=20=D0=BF=D0=BE=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D1=8F=D0=BB=20=D0=B0=D0=BF=D0=B8,=20pep8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/routes/wallpaper.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/routes/wallpaper.py b/src/routes/wallpaper.py index f9bbdf2..fba7765 100644 --- a/src/routes/wallpaper.py +++ b/src/routes/wallpaper.py @@ -9,16 +9,11 @@ router = APIRouter() template = Jinja2Templates(directory='./src/web/html') -def get_wallpaper(date: str): - return requests.get('https://api.nasa.gov/planetary/apod', params={ - 'api_key': '1gI9G84ZafKDEnrbydviGknReOGiVK9jqrQBE3et', - 'date': date, - }) @router.get('/wallpaper/today', response_class=HTMLResponse) -async def today_wallpaper(requests: Request): +async def today_wallpaper(request: Request): date = datetime.today().strftime('%Y-%m-%d') - res = get_wallpaper(date) + res = requests.get(f'https://api.starlio.space/wallpaper/last') if res.status_code != 200: return FileResponse('./src/web/html/error/404.html') @@ -28,7 +23,8 @@ async def today_wallpaper(requests: Request): @router.get('/wallpaper/{day}', response_class=HTMLResponse) async def wallpaper(request: Request, day): - res = get_wallpaper(day) + res = requests.get(f'https://api.starlio.space/wallpaper/{day}') + print(res) if res.status_code != 200: return FileResponse('./src/web/html/error/404.html') @@ -37,4 +33,4 @@ async def wallpaper(request: Request, day): request, '/wallpaper.html', {'info': res.json()} - ) \ No newline at end of file + )