Last active
December 15, 2021 19:05
-
-
Save Itz-fork/8fc17d02392c2b134c91bb2b87d43e8d to your computer and use it in GitHub Desktop.
Random Anime Wallpaper API example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
def get_random_anime_wallpaper(q=None): | |
""" | |
q - The name (query) you want to search about | |
""" | |
if q: | |
req = requests.get(f"https://nexa-apis.herokuapp.com/anime_wall?query={q}").json() | |
else: | |
req = requests.get("https://nexa-apis.herokuapp.com/anime_wall").json() | |
if req["status"] == "Ok": | |
return req["data"] | |
else: | |
return None | |
a_walls = get_random_anime_wallpaper() | |
if a_walls: | |
print(a_walls) | |
else: | |
print("Oops, Error Happend!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment