logo

searx

Unnamed repository; edit this file 'description' to name the repository.
commit: a65070a72d1deecbcb5bd9a2905120d326a00527
parent: 060ea4d2f54061f89a1846de4fbce82ff10c594c
Author: asciimoo <asciimoo@gmail.com>
Date:   Sun, 12 Jan 2014 20:13:14 +0100

[enh] own useragent handling init

Diffstat:

searx/engines/__init__.py | 4+++-
searx/utils.py | 4++++
2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/searx/engines/__init__.py b/searx/engines/__init__.py @@ -23,6 +23,7 @@ from itertools import izip_longest, chain from operator import itemgetter from urlparse import urlparse from searx import settings +from searx.utils import get_useragent import ConfigParser import sys from datetime import datetime @@ -151,7 +152,8 @@ def search(query, request, selected_engines): results = {} suggestions = set() 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: if selected_engine['name'] not in engines: diff --git a/searx/utils.py b/searx/utils.py @@ -5,6 +5,10 @@ import codecs import cStringIO 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): if not content: