diff options
author | Ruoqi Yang <[email protected]> | 2022-09-18 14:08:14 +0800 |
---|---|---|
committer | Ruoqi Yang <[email protected]> | 2022-09-18 14:08:14 +0800 |
commit | 6294c3265630542221e870f9691e429500b02425 (patch) | |
tree | 7b11f9609b34df04288bea06ddb6f88ba992822f /ATRI/plugins | |
parent | d43c5423add954db12a8b31ab528afd9b2e60974 (diff) | |
download | ATRI-6294c3265630542221e870f9691e429500b02425.tar.gz ATRI-6294c3265630542221e870f9691e429500b02425.tar.bz2 ATRI-6294c3265630542221e870f9691e429500b02425.zip |
- config httpx timeout
- trace.moe api call upload image
Diffstat (limited to 'ATRI/plugins')
-rw-r--r-- | ATRI/plugins/anime_search.py | 7 |
1 files changed, 4 insertions, 3 deletions
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() |