.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.engines.pypi Namespace Reference

Functions

 request (query, params)
 
 response (resp)
 

Variables

dict about
 
list categories = ['it', 'packages']
 
int first_page_num = 1
 
str base_url = "https://pypi.org"
 
str search_url = base_url + '/search/?{query}'
 

Detailed Description

pypi.org

Function Documentation

◆ request()

searx.engines.pypi.request ( query,
params )

Definition at line 35 of file pypi.py.

35def request(query, params):
36 args = {
37 "q": query,
38 "page": params['pageno'],
39 }
40 params['url'] = search_url.format(query=urlencode(args))
41 return params
42
43

◆ response()

searx.engines.pypi.response ( resp)

Definition at line 44 of file pypi.py.

44def response(resp):
45 results = []
46 dom = html.fromstring(resp.text)
47 for entry in eval_xpath_list(dom, '/html/body/main/div/div/div/form/div/ul/li/a[@class="package-snippet"]'):
48 url = base_url + extract_text(eval_xpath_getindex(entry, './@href', 0)) # type: ignore
49 title = extract_text(eval_xpath_getindex(entry, './h3/span[@class="package-snippet__name"]', 0))
50 version = extract_text(eval_xpath_getindex(entry, './h3/span[@class="package-snippet__version"]', 0))
51 created_at = extract_text(
52 eval_xpath_getindex(entry, './h3/span[@class="package-snippet__created"]/time/@datetime', 0)
53 )
54 content = extract_text(eval_xpath_getindex(entry, './p', 0))
55 results.append(
56 {
57 "template": "packages.html",
58 "url": url,
59 "title": title,
60 'package_name': title,
61 "content": content,
62 "version": version,
63 'publishedDate': parser.parse(created_at), # type: ignore
64 }
65 )
66
67 return results

Variable Documentation

◆ about

dict searx.engines.pypi.about
Initial value:
1= {
2 "website": "https://pypi.org",
3 "wikidata_id": "Q2984686",
4 "official_api_documentation": "https://warehouse.readthedocs.io/api-reference/index.html",
5 "use_official_api": False,
6 "require_api_key": False,
7 "results": "HTML",
8}

Definition at line 17 of file pypi.py.

◆ base_url

str searx.engines.pypi.base_url = "https://pypi.org"

Definition at line 31 of file pypi.py.

◆ categories

list searx.engines.pypi.categories = ['it', 'packages']

Definition at line 26 of file pypi.py.

◆ first_page_num

int searx.engines.pypi.first_page_num = 1

Definition at line 30 of file pypi.py.

◆ search_url

str searx.engines.pypi.search_url = base_url + '/search/?{query}'

Definition at line 32 of file pypi.py.