forked from rafaelalmeida2909/Python-Simple-Programs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyearthview.py
More file actions
24 lines (22 loc) · 710 Bytes
/
Copy pathpyearthview.py
File metadata and controls
24 lines (22 loc) · 710 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import requests
from random import randint
import ctypes
import urllib
import os
value = randint(1000,2000)
link = "https://earthview.withgoogle.com/download/"+ str(value)+".jpg"
r = requests.get(link)
status = True
while status:
if (r.status_code != 200):
value = randint(1000,2000)
link = "https://earthview.withgoogle.com/download/"+ str(value) +".jpg"
r = requests.get(link)
else:
print(r.status_code)
print(link)
filename = os.getcwd() + "\wallpaper.jpg"
print(filename)
urllib.request.urlretrieve(link, filename)
ctypes.windll.user32.SystemParametersInfoW(20, 0, filename , 0)
status = False