New wallpaper from apod (simple python script)
- 📅 2021-05-07T17:27:21.000Z
- 👁️ 135 katselukertaa
- 🔓 Julkinen
#https://gist.github.com/kaikkitietokoneista/c1bb458f83fa319cdab8432ec99c521b
import urllib.request, json, os, ctypes
key = "<your_apod_api_key>"
bg_path = "<path_to_your_backgrounds_folder>"
with urllib.request.urlopen("https://api.nasa.gov/planetary/apod?api_key=" + key) as url:
data = json.loads(url.read().decode())
file = os.path.basename(data["hdurl"])
save_path = bg_path + file
urllib.request.urlretrieve(data["hdurl"], save_path)
ctypes.windll.user32.SystemParametersInfoW(20, 0, save_path , 0)