Skip to content

Commit

Permalink
TesT
Browse files Browse the repository at this point in the history
  • Loading branch information
abelfodil committed Dec 9, 2024
1 parent daaedaf commit 7ad9f21
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions wallpaper.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,10 @@ def _get_random_wallpaper():
"ratios": "16x9,16x10",
}

with urlopen(Request(api_url + urlencode(params), headers={"User-Agent": "randwall/1.0"})) as f:
response = f.read().decode("utf-8")

try:
with urlopen(Request(api_url + urlencode(params), headers={"User-Agent": "randwall/1.0"})) as f:
response = f.read().decode("utf-8")
data = json.loads(response)
image_data = data["data"][0]
return {
Expand Down

0 comments on commit 7ad9f21

Please sign in to comment.