From 70b6fcb56ecbe21de200b51e16fbbb90bc494460 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Fri, 28 Jun 2024 16:07:45 +0800 Subject: [PATCH] :bug: Fix user agent --- func/base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/func/base.py b/func/base.py index 7250fef..2a2e75c 100644 --- a/func/base.py +++ b/func/base.py @@ -7,7 +7,10 @@ from pathlib import Path BASE_URL = "https://api.encore.moe/zh-Hans" -client = AsyncClient(timeout=60.0) +headers = { + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36", +} +client = AsyncClient(timeout=60.0, headers=headers) data_path = Path("data") data_path.mkdir(exist_ok=True)