Skip to content

Instantly share code, notes, and snippets.

@Itz-fork
Last active December 15, 2021 19:05
Show Gist options
  • Save Itz-fork/8fc17d02392c2b134c91bb2b87d43e8d to your computer and use it in GitHub Desktop.
Save Itz-fork/8fc17d02392c2b134c91bb2b87d43e8d to your computer and use it in GitHub Desktop.
Random Anime Wallpaper API example
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