Skip to content

Instantly share code, notes, and snippets.

@Itz-fork
Created December 30, 2021 13:46
Show Gist options
  • Save Itz-fork/fd0d26eec096ce479f1b34a2cfca4f75 to your computer and use it in GitHub Desktop.
Save Itz-fork/fd0d26eec096ce479f1b34a2cfca4f75 to your computer and use it in GitHub Desktop.
Wallpaper API Example
import requests
def search_and_get_wallpapers(q="aesthetic"):
"""
q - The name (query) you want to search about
"""
if q:
req = requests.get(f"https://nexa-apis.herokuapp.com/wallpaper?query={q}").json()
else:
req = requests.get("https://nexa-apis.herokuapp.com/wallpaper").json()
if req["status"] == "Ok":
return req["data"]
else:
return None
walls = search_and_get_wallpapers()
if walls:
print(walls)
else:
print("Oops, Error Happend!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment