summaryrefslogtreecommitdiff
path: root/searx/query.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/query.py
parent46a2c63f8e1c3819cceff2d61fe9106051e8ecee (diff)
downloadsearxng-52e615dede8538c36f569d2cf07835427a9a0db6.tar.gz
searxng-52e615dede8538c36f569d2cf07835427a9a0db6.zip
[enh] py3 compatibility
Diffstat (limited to 'searx/query.py')
-rw-r--r--searx/query.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/searx/query.py b/searx/query.py
index b8b1c0d2f..828a6fb30 100644
--- a/searx/query.py
+++ b/searx/query.py
@@ -21,8 +21,12 @@ from searx.languages import language_codes
from searx.engines import (
categories, engines, engine_shortcuts
)
-import string
import re
+import string
+import sys
+
+if sys.version_info[0] == 3:
+ unicode = str
VALID_LANGUAGE_CODE = re.compile(r'^[a-z]{2,3}(-[a-zA-Z]{2})?$')
@@ -146,7 +150,7 @@ class SearchQuery(object):
"""container for all the search parameters (query, language, etc...)"""
def __init__(self, query, engines, categories, lang, safesearch, pageno, time_range):
- self.query = query
+ self.query = query.encode('utf-8')
self.engines = engines
self.categories = categories
self.lang = lang