From 3d9274309aef6fbe62939f7c102eec56c94bb4b2 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Mon, 4 Jul 2022 05:55:52 +0000 Subject: [PATCH] Fix requests text encoding slowness --- apiserver/search.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apiserver/search.py b/apiserver/search.py index 8f4a0a3..9161179 100644 --- a/apiserver/search.py +++ b/apiserver/search.py @@ -16,6 +16,7 @@ def meili_api(method, route, json=None, params=None, parse_json=True): if parse_json: return r.json() else: + r.encoding = 'utf-8' return r.text except KeyboardInterrupt: raise @@ -52,7 +53,7 @@ def put_story(story): def search(q): if not SEARCH_ENABLED: return [] - params = dict(q=q, limit=250) + params = dict(q=q, limit=100) r = meili_api(requests.get, 'indexes/qotnews/search', params=params, parse_json=False) return r