diff --git a/sources/tools/searxSearch.py b/sources/tools/searxSearch.py index 2bc31d0..6bb1394 100644 --- a/sources/tools/searxSearch.py +++ b/sources/tools/searxSearch.py @@ -2,6 +2,7 @@ import requests from bs4 import BeautifulSoup import sys import os +from urllib.parse import urlencode if __name__ == "__main__": # if running as a script for individual testing sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) @@ -78,7 +79,14 @@ class searxSearch(Tools): 'Upgrade-Insecure-Requests': '1', 'User-Agent': self.user_agent } - data = f"q={query}&categories=general&language=auto&time_range=&safesearch=0&theme=simple".encode('utf-8') + data = urlencode({ + 'q': query, + 'categories': 'general', + 'language': 'auto', + 'time_range': '', + 'safesearch': '0', + 'theme': 'simple' + }).encode('utf-8') try: response = requests.post(search_url, headers=headers, data=data, verify=False) response.raise_for_status() @@ -102,7 +110,7 @@ class searxSearch(Tools): """ Checks if the execution failed based on the output. """ - return "Error" in output + return "Error" in output or "No search results" in output def interpreter_feedback(self, output: str) -> str: """