Created
December 30, 2021 13:46
-
-
Save Itz-fork/fd0d26eec096ce479f1b34a2cfca4f75 to your computer and use it in GitHub Desktop.
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 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