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 + )