forked from Icycoide/searxng
[enh] py3 compatibility
This commit is contained in:
parent
46a2c63f8e
commit
52e615dede
115 changed files with 517 additions and 513 deletions
|
@ -14,9 +14,12 @@ along with searx. If not, see < http://www.gnu.org/licenses/ >.
|
|||
|
||||
(C) 2015 by Adam Tauber, <asciimoo@gmail.com>
|
||||
'''
|
||||
from sys import exit
|
||||
from sys import exit, version_info
|
||||
from searx import logger
|
||||
|
||||
if version_info[0] == 3:
|
||||
unicode = str
|
||||
|
||||
logger = logger.getChild('plugins')
|
||||
|
||||
from searx.plugins import (doai_rewrite,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from flask_babel import gettext
|
||||
import re
|
||||
from urlparse import urlparse, parse_qsl
|
||||
from searx.url_utils import urlparse, parse_qsl
|
||||
|
||||
regex = re.compile(r'10\.\d{4,9}/[^\s]+')
|
||||
|
||||
|
|
|
@ -16,14 +16,17 @@ along with searx. If not, see < http://www.gnu.org/licenses/ >.
|
|||
'''
|
||||
|
||||
import re
|
||||
from urlparse import urlparse
|
||||
import sys
|
||||
from lxml import etree
|
||||
from os import listdir, environ
|
||||
from os.path import isfile, isdir, join
|
||||
from searx.plugins import logger
|
||||
from flask_babel import gettext
|
||||
from searx import searx_dir
|
||||
from searx.url_utils import urlparse
|
||||
|
||||
if sys.version_info[0] == 3:
|
||||
unicode = str
|
||||
|
||||
name = "HTTPS rewrite"
|
||||
description = gettext('Rewrite HTTP links to HTTPS if possible')
|
||||
|
|
|
@ -22,7 +22,7 @@ default_on = True
|
|||
|
||||
|
||||
# Self User Agent regex
|
||||
p = re.compile('.*user[ -]agent.*', re.IGNORECASE)
|
||||
p = re.compile(b'.*user[ -]agent.*', re.IGNORECASE)
|
||||
|
||||
|
||||
# attach callback to the post search hook
|
||||
|
@ -31,7 +31,7 @@ p = re.compile('.*user[ -]agent.*', re.IGNORECASE)
|
|||
def post_search(request, search):
|
||||
if search.search_query.pageno > 1:
|
||||
return True
|
||||
if search.search_query.query == 'ip':
|
||||
if search.search_query.query == b'ip':
|
||||
x_forwarded_for = request.headers.getlist("X-Forwarded-For")
|
||||
if x_forwarded_for:
|
||||
ip = x_forwarded_for[0]
|
||||
|
|
|
@ -17,7 +17,7 @@ along with searx. If not, see < http://www.gnu.org/licenses/ >.
|
|||
|
||||
from flask_babel import gettext
|
||||
import re
|
||||
from urlparse import urlunparse
|
||||
from searx.url_utils import urlunparse
|
||||
|
||||
regexes = {re.compile(r'utm_[^&]+&?'),
|
||||
re.compile(r'(wkey|wemail)[^&]+&?'),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue