mirror of
https://github.com/searxng/searxng
synced 2024-01-01 18:24:07 +00:00
[enh] own useragent handling init
This commit is contained in:
parent
060ea4d2f5
commit
a65070a72d
@ -23,6 +23,7 @@ from itertools import izip_longest, chain
|
|||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
from urlparse import urlparse
|
from urlparse import urlparse
|
||||||
from searx import settings
|
from searx import settings
|
||||||
|
from searx.utils import get_useragent
|
||||||
import ConfigParser
|
import ConfigParser
|
||||||
import sys
|
import sys
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
@ -151,7 +152,8 @@ def search(query, request, selected_engines):
|
|||||||
results = {}
|
results = {}
|
||||||
suggestions = set()
|
suggestions = set()
|
||||||
number_of_searches += 1
|
number_of_searches += 1
|
||||||
user_agent = request.headers.get('User-Agent', '')
|
#user_agent = request.headers.get('User-Agent', '')
|
||||||
|
user_agent = get_useragent()
|
||||||
|
|
||||||
for selected_engine in selected_engines:
|
for selected_engine in selected_engines:
|
||||||
if selected_engine['name'] not in engines:
|
if selected_engine['name'] not in engines:
|
||||||
|
@ -5,6 +5,10 @@ import codecs
|
|||||||
import cStringIO
|
import cStringIO
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
def get_useragent():
|
||||||
|
# TODO
|
||||||
|
return "Mozilla/5.0 (X11; Linux x86_64; rv:26.0) Gecko/20100101 Firefox/26.0"
|
||||||
|
|
||||||
def highlight_content(content, query):
|
def highlight_content(content, query):
|
||||||
|
|
||||||
if not content:
|
if not content:
|
||||||
|
Loading…
Reference in New Issue
Block a user