An open source, non-profit web search engine
Add user agent
Daoud Clarke66e8a94e30d4
diff --git a/mwmbl/tinysearchengine/rank.py b/mwmbl/tinysearchengine/rank.pyindex 2197a63..7750fc6 100644--- a/mwmbl/tinysearchengine/rank.py+++ b/mwmbl/tinysearchengine/rank.py@@ -342,8 +342,11 @@ def clean_html(s: str):def get_wiki_results(s: str, max_wiki_results: int) -> list[Document]:escaped_query = urllib.parse.quote(s, safe='')+ headers = {+ 'User-Agent': 'Mwmbl/0.1.0 (https://mwmbl.org; [email protected]) requests-cache'+ }with request_cache(timedelta(weeks=10)) as session:- response = session.get(WIKI_SEARCH_API_URL.format(query=escaped_query))+ response = session.get(WIKI_SEARCH_API_URL.format(query=escaped_query), headers=headers)try:wiki_response = response.json()except json.JSONDecodeError: