sfw-waifu / app.py
KazeDevID's picture
Update app.py
fbfac61 verified
raw
history blame
464 Bytes
import requests
def get_waifu_image():
try:
response = requests.get('https://api.waifu.pics/sfw/waifu')
response.raise_for_status() # Memastikan permintaan berhasil
image_url = response.json().get('url') # Mengambil URL gambar
return {"url": image_url} # Mengembalikan hasil dalam format JSON
except Exception as e:
return {"error": str(e)}
# Menampilkan output langsung
output = get_waifu_image()
print(output)