Skip to content

Commit 54f0dfa

Browse files
committed
fix: added user agent since the script was broken on Arch Linux
1 parent 6d791a7 commit 54f0dfa

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/greetings/main.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,11 @@ def is_binary():
104104
if not save_images and os.path.isfile(image_file):
105105
os.remove(image_file)
106106
try: # Fetch and write image.
107-
res = requests.get('https://bing.biturl.top/', timeout=10)
107+
108+
headers = {
109+
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36"
110+
}
111+
res = requests.get('https://bing.biturl.top/', timeout=10, headers=headers)
108112
res.raise_for_status()
109113
link = res.json().get("url") # Get the URL to the image.
110114
if not link: # Exit if the response does not contain the image URL.
@@ -126,4 +130,4 @@ def is_binary():
126130
sizeFile.write(f"{terminalSizeTuple.columns},{terminalSizeTuple.lines}")
127131
except subprocess.CalledProcessError as e:
128132
print(f"Error running ascii-image-converter: {e}")
129-
sys.exit(1)
133+
sys.exit(1)

0 commit comments

Comments
 (0)