From bb957992cd4bbf2b4e28a4b4216caa24876f6878 Mon Sep 17 00:00:00 2001 From: Ian Andwati Date: Wed, 27 Sep 2023 03:56:26 +0300 Subject: [PATCH] feature --- unsplashbot/bot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unsplashbot/bot.py b/unsplashbot/bot.py index 396ec47..1bec26f 100644 --- a/unsplashbot/bot.py +++ b/unsplashbot/bot.py @@ -12,12 +12,12 @@ def send_welcome(message): @bot.message_handler(commands=["random"]) def get_random_photo(message): - url = "https://api.unsplash.com/photos/random" + url = f"{BASE_URL}/photos/random" response = requests.get( url, timeout=10, headers={"Authorization": f"Client-ID {ACCESS_TOKEN}"} ) data = response.json() - image_url = data["urls"]["regular"] + image_url = data["links"]["download"] description = data["alt_description"] image_content = requests.get(image_url)