def request(query, params): offset = (params['pageno'] - 1) * number_of_results + 1 categorie = search_category.get(params['category'], 'web') if params['language'] == 'all': language = 'en' else: language = params['language'].split('_')[0] # if language is not supported, put it in english if language != 'en' and\ language != 'de' and\ language != 'zh': language = 'en' params['url'] = search_url.format(offset=offset, number_of_results=number_of_results, query=urlencode({'q': query}), language=language, categorie=categorie, api_key=api_key) # using searx User-Agent params['headers']['User-Agent'] = searx_useragent() return params
def request(query, params): params['url'] = base_url + search_string.format(query=query) # using searx User-Agent params['headers']['User-Agent'] = searx_useragent() return params
def request(query, params): params["url"] = base_url + search_string.format(query=query) # using searx User-Agent params["headers"]["User-Agent"] = searx_useragent() return params
def request(query, params): """do search-request""" params['url'] = base_url + search_string.format( query=urlencode({'q': query})) params['route'] = route_re.match(query) params['headers']['User-Agent'] = searx_useragent() return params
def request(query, params): if query.islower(): query = query.title() params['url'] = search_url.format(title=quote(query), language=url_lang(params['language'])) params['headers']['User-Agent'] = searx_useragent() return params
def request(query, params): if query.islower(): query = query.title() params['url'] = search_url.format(title=quote(query), language=url_lang(params['language'])) params['headers']['User-Agent'] = searx_useragent() params['raise_for_httperror'] = False params['soft_max_redirects'] = 2 return params
def request(query, params): params['url'] = base_url +\ search_string.format(query=urlencode({'q': query}), limit=number_of_results) language = params['language'].split('-')[0] if language in supported_languages: params['url'] = params['url'] + "&lang=" + language # using searx User-Agent params['headers']['User-Agent'] = searx_useragent() return params
def request(query, params): if query.islower(): query = query.title() language = url_lang(params['language']) params['url'] = search_url.format(title=quote(query), language=language) if params['language'].lower() in language_variants.get(language, []): params['headers']['Accept-Language'] = params['language'].lower() params['headers']['User-Agent'] = searx_useragent() params['raise_for_httperror'] = False params['soft_max_redirects'] = 2 return params
def request(query, params): # replace shortcuts with API advanced search keywords for key in shorcut_dict.keys(): query = re.sub(str(key), str(shorcut_dict[key]), query) # basic search offset = (params['pageno'] - 1) * number_of_results string_args = dict(query=urlencode({'query': query}), offset=offset, hits=number_of_results) params['url'] = base_url.format(**string_args) params['headers']['User-Agent'] = searx_useragent() return params
def request(query, params): params['url'] = base_url +\ search_string.format(query=urlencode({'q': query}), limit=number_of_results) if params['language'] != 'all': language = params['language'].split('_')[0] if language in allowed_languages: params['url'] = params['url'] + "&lang=" + language # using searx User-Agent params['headers']['User-Agent'] = searx_useragent() # FIX: SSLError: SSL3_GET_SERVER_CERTIFICATE:certificate verify failed params['verify'] = False return params
def get_headers(): # user agent: https://www.mediawiki.org/wiki/Wikidata_Query_Service/User_Manual#Query_limits return { 'Accept': 'application/sparql-results+json', 'User-Agent': searx_useragent() }
def test_searx_useragent(self): self.assertIsInstance(utils.searx_useragent(), str) self.assertIsNotNone(utils.searx_useragent()) self.assertTrue(utils.searx_useragent().startswith('searx'))