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 147c44e commit ffbefd6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

def get(*args, **kwargs):
return urlopen(
Request(*args, **kwargs, method="GET", headers={"User-Agent": "randwall/1.0"}),
Request(*args, **kwargs, method="GET", headers={"User-Agent": "Mozilla/5.0"}),
context=ssl.create_default_context(cafile=certifi.where()),
)
4 changes: 2 additions & 2 deletions wallpaper.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ def _get_random_wallpaper():

logger.info(f"Fetching random wallpaper from https://wallhaven.cc")

with get(api_url + urlencode(params)) as f:
response = f.read().decode("utf-8")
try:
with get(api_url + urlencode(params)) as f:
response = f.read().decode("utf-8")
data = json.loads(response)
image_data = data["data"][0]
return {
Expand Down

0 comments on commit ffbefd6

Please sign in to comment.