1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-22 20:17:45 +01:00

[enh] better useragent string generation

This commit is contained in:
Adam Tauber 2014-03-04 14:20:37 +01:00
parent 98b6313d5d
commit 71c2e8222b

View File

@ -4,12 +4,15 @@ import csv
from codecs import getincrementalencoder from codecs import getincrementalencoder
import cStringIO import cStringIO
import re import re
from random import choice
ua_versions = ('26.0', '27.0', '28.0')
ua_os = ('Windows NT 6.3; WOW64', 'X11; Linux x86_64; rv:26.0')
ua = "Mozilla/5.0 ({os}) Gecko/20100101 Firefox/{version}"
def gen_useragent(): def gen_useragent():
# TODO # TODO
ua = "Mozilla/5.0 (X11; Linux x86_64; rv:26.0) Gecko/20100101 Firefox/26.0" return ua.format(os=choice(ua_os), version=choice(ua_versions))
return ua
def highlight_content(content, query): def highlight_content(content, query):