summaryrefslogtreecommitdiff
path: root/searx/search.py
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2016-11-30 18:43:03 +0100
committerAdam Tauber <asciimoo@gmail.com>2017-05-15 12:02:30 +0200
commit52e615dede8538c36f569d2cf07835427a9a0db6 (patch)
treeac65990c72156def2d49e81d981f0b3beda4fd2e /searx/search.py
parent46a2c63f8e1c3819cceff2d61fe9106051e8ecee (diff)
downloadsearxng-52e615dede8538c36f569d2cf07835427a9a0db6.tar.gz
searxng-52e615dede8538c36f569d2cf07835427a9a0db6.zip
[enh] py3 compatibility
Diffstat (limited to 'searx/search.py')
-rw-r--r--searx/search.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/searx/search.py b/searx/search.py
index 980cfeb99..790e7d071 100644
--- a/searx/search.py
+++ b/searx/search.py
@@ -16,8 +16,8 @@ along with searx. If not, see < http://www.gnu.org/licenses/ >.
'''
import gc
+import sys
import threading
-from thread import start_new_thread
from time import time
from uuid import uuid4
import requests.exceptions
@@ -33,6 +33,14 @@ from searx import logger
from searx.plugins import plugins
from searx.exceptions import SearxParameterException
+try:
+ from thread import start_new_thread
+except:
+ from _thread import start_new_thread
+
+if sys.version_info[0] == 3:
+ unicode = str
+
logger = logger.getChild('search')
number_of_searches = 0
@@ -387,7 +395,7 @@ class Search(object):
request_params['time_range'] = search_query.time_range
# append request to list
- requests.append((selected_engine['name'], search_query.query.encode('utf-8'), request_params))
+ requests.append((selected_engine['name'], search_query.query, request_params))
# update timeout_limit
timeout_limit = max(timeout_limit, engine.timeout)