.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.plugins.self_info Namespace Reference

Functions

 post_search (request, search)
 

Variables

 name = gettext('Self Information')
 
 description = gettext('Displays your IP if the query is "ip" and your user agent if the query contains "user agent".')
 
bool default_on = True
 
str preference_section = 'query'
 
list query_keywords = ['user-agent']
 
str query_examples = ''
 
 ip_regex = re.compile('^ip$|my ip', re.IGNORECASE)
 
 ua_regex = re.compile('.*user[ -]agent.*', re.IGNORECASE)
 

Function Documentation

◆ post_search()

searx.plugins.self_info.post_search ( request,
search )

Definition at line 23 of file self_info.py.

23def post_search(request, search):
24 if search.search_query.pageno > 1:
25 return True
26 if ip_regex.search(search.search_query.query):
27 ip = get_real_ip(request)
28 search.result_container.answers['ip'] = {'answer': gettext('Your IP is: ') + ip}
29 elif ua_regex.match(search.search_query.query):
30 ua = request.user_agent
31 search.result_container.answers['user-agent'] = {'answer': gettext('Your user-agent is: ') + ua.string}
32 return True

Variable Documentation

◆ default_on

bool searx.plugins.self_info.default_on = True

Definition at line 11 of file self_info.py.

◆ description

searx.plugins.self_info.description = gettext('Displays your IP if the query is "ip" and your user agent if the query contains "user agent".')

Definition at line 10 of file self_info.py.

◆ ip_regex

searx.plugins.self_info.ip_regex = re.compile('^ip$|my ip', re.IGNORECASE)

Definition at line 17 of file self_info.py.

◆ name

searx.plugins.self_info.name = gettext('Self Information')

Definition at line 9 of file self_info.py.

◆ preference_section

str searx.plugins.self_info.preference_section = 'query'

Definition at line 12 of file self_info.py.

◆ query_examples

str searx.plugins.self_info.query_examples = ''

Definition at line 14 of file self_info.py.

◆ query_keywords

list searx.plugins.self_info.query_keywords = ['user-agent']

Definition at line 13 of file self_info.py.

◆ ua_regex

searx.plugins.self_info.ua_regex = re.compile('.*user[ -]agent.*', re.IGNORECASE)

Definition at line 20 of file self_info.py.