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

Functions

 request (query, params)
 
 response (resp)
 

Variables

dict about
 
list categories = ['it', 'packages']
 
bool paging = True
 
str base_url = "https://hub.docker.com/"
 
str search_url = base_url + "api/content/v1/products/search?{query}&type=image&page_size=25"
 

Detailed Description

Docker Hub (IT)

Function Documentation

◆ request()

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

Definition at line 26 of file docker_hub.py.

26def request(query, params):
27
28 params['url'] = search_url.format(query=urlencode(dict(q=query, page=params["pageno"])))
29 params["headers"]["Search-Version"] = "v3"
30
31 return params
32
33

◆ response()

searx.engines.docker_hub.response ( resp)
post-response callback
resp: requests response object

Definition at line 34 of file docker_hub.py.

34def response(resp):
35 '''post-response callback
36 resp: requests response object
37 '''
38 results = []
39 body = resp.json()
40
41 for item in body.get("summaries", []):
42 filter_type = item.get("filter_type")
43 is_official = filter_type in ["store", "official"]
44
45 result = {
46 'template': 'packages.html',
47 'url': base_url + ("_/" if is_official else "r/") + item.get("slug", ""),
48 'title': item.get("name"),
49 'content': item.get("short_description"),
50 'thumbnail': item["logo_url"].get("large") or item["logo_url"].get("small"),
51 'package_name': item.get("name"),
52 'maintainer': item["publisher"].get("name"),
53 'publishedDate': parser.parse(item.get("updated_at") or item.get("created_at")),
54 'popularity': item.get("pull_count", "0") + " pulls",
55 'tags': [arch['name'] for arch in item["architectures"]],
56 }
57 results.append(result)
58
59 return results

Variable Documentation

◆ about

dict searx.engines.docker_hub.about
Initial value:
1= {
2 "website": 'https://hub.docker.com',
3 "wikidata_id": 'Q100769064',
4 "official_api_documentation": 'https://docs.docker.com/registry/spec/api/',
5 "use_official_api": True,
6 "require_api_key": False,
7 "results": 'JSON',
8}

Definition at line 10 of file docker_hub.py.

◆ base_url

str searx.engines.docker_hub.base_url = "https://hub.docker.com/"

Definition at line 22 of file docker_hub.py.

◆ categories

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

Definition at line 19 of file docker_hub.py.

◆ paging

bool searx.engines.docker_hub.paging = True

Definition at line 20 of file docker_hub.py.

◆ search_url

str searx.engines.docker_hub.search_url = base_url + "api/content/v1/products/search?{query}&type=image&page_size=25"

Definition at line 23 of file docker_hub.py.