From e99db8db26ba8fe31da782ad1f3b7f59a8989a61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o?= Date: Wed, 26 Oct 2022 18:20:21 +0200 Subject: [PATCH] Add country and interface lang to autocomplete (#866) --- app/request.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/request.py b/app/request.py index fe17734..7bfbbad 100644 --- a/app/request.py +++ b/app/request.py @@ -188,6 +188,8 @@ class Request: config.lang_search if config.lang_search else '' ) + self.country = config.country if config.country else '' + # For setting Accept-language Header self.lang_interface = '' if config.accept_language: @@ -244,7 +246,11 @@ class Request: """ ac_query = dict(q=query) if self.language: - ac_query['hl'] = self.language + ac_query['lr'] = self.language + if self.country: + ac_query['gl'] = self.country + if self.lang_interface: + ac_query['hl'] = self.lang_interface response = self.send(base_url=AUTOCOMPLETE_URL, query=urlparse.urlencode(ac_query)).text