From 6294c3265630542221e870f9691e429500b02425 Mon Sep 17 00:00:00 2001 From: Ruoqi Yang Date: Sun, 18 Sep 2022 14:08:14 +0800 Subject: - config httpx timeout - trace.moe api call upload image --- ATRI/plugins/anime_search.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'ATRI/plugins') diff --git a/ATRI/plugins/anime_search.py b/ATRI/plugins/anime_search.py index 670c766..bf06ece 100644 --- a/ATRI/plugins/anime_search.py +++ b/ATRI/plugins/anime_search.py @@ -9,7 +9,7 @@ from ATRI.utils import request, Translate from ATRI.exceptions import RequestError -URL = "https://api.trace.moe/search?anilistInfo=true&url=" +URL = "https://api.trace.moe/search?anilistInfo=true" _anime_flmt_notice = choice(["慢...慢一..点❤", "冷静1下", "歇会歇会~~"]) @@ -21,9 +21,10 @@ class Anime(Service): @staticmethod async def _request(url: str) -> dict: - aim = URL + url try: - res = await request.get(aim) + resp = await request.get(url) + image_bytes = resp.read() + res = await request.post(URL, data=image_bytes, headers={"Content-Type": "image/jpeg"}) except Exception: raise RequestError("Request failed!") result = res.json() -- cgit v1.2.3