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

Functions

 request (str query, params)
 
 response (resp)
 

Variables

dict about
 
list categories = ["it", "packages"]
 
bool paging = True
 
str search_url = "https://hex.pm/api/packages/"
 
str sort_criteria = "recent_downloads"
 
int page_size = 10
 
dict linked_terms
 

Detailed Description

hex.pm

Function Documentation

◆ request()

searx.engines.hex.request ( str query,
params )

Definition at line 52 of file hex.py.

52def request(query: str, params):
53 args = urlencode({"page": params["pageno"], "per_page": page_size, "sort": sort_criteria, "search": query})
54 params["url"] = f"{search_url}?{args}"
55 return params
56
57

◆ response()

searx.engines.hex.response ( resp)

Definition at line 58 of file hex.py.

58def response(resp):
59 results = []
60 for package in resp.json():
61 meta = package["meta"]
62 published_date = package.get("updated_at")
63 published_date = parser.parse(published_date)
64 links = {linked_terms.get(k.lower(), k): v for k, v in meta.get("links").items()}
65 results.append(
66 {
67 "template": "packages.html",
68 "url": package["html_url"],
69 "title": package["name"],
70 "package_name": package["name"],
71 "content": meta.get("description", ""),
72 "version": meta.get("latest_version"),
73 "maintainer": ", ".join(meta.get("maintainers", [])),
74 "publishedDate": published_date,
75 "license_name": ", ".join(meta.get("licenses", [])),
76 "homepage": package["docs_html_url"],
77 "links": links,
78 }
79 )
80
81 return results

Variable Documentation

◆ about

dict searx.engines.hex.about
Initial value:
1= {
2 # pylint: disable=line-too-long
3 "website": "https://hex.pm/",
4 "wikidata_id": None,
5 "official_api_documentation": "https://github.com/hexpm/hexpm/blob/main/lib/hexpm_web/controllers/api/package_controller.ex",
6 "use_official_api": True,
7 "require_api_key": False,
8 "results": "JSON",
9}

Definition at line 8 of file hex.py.

◆ categories

list searx.engines.hex.categories = ["it", "packages"]

Definition at line 18 of file hex.py.

◆ linked_terms

dict searx.engines.hex.linked_terms
Initial value:
1= {
2 # lower-case : replacement
3 "author": "Author",
4 "bitbucket": "Bitbucket",
5 "bug tracker": "Issue tracker",
6 "changelog": "Changelog",
7 "doc": "Documentation",
8 "docs": "Documentation",
9 "documentation": "Documentation",
10 "github repository": "GitHub",
11 "github": "GitHub",
12 "gitlab": "GitLab",
13 "issues": "Issue tracker",
14 "project source code": "Source code",
15 "repository": "Source code",
16 "scm": "Source code",
17 "sourcehut": "SourceHut",
18 "sources": "Source code",
19 "sponsor": "Sponsors",
20 "sponsors": "Sponsors",
21 "website": "Homepage",
22}

Definition at line 28 of file hex.py.

◆ page_size

int searx.engines.hex.page_size = 10

Definition at line 26 of file hex.py.

◆ paging

bool searx.engines.hex.paging = True

Definition at line 22 of file hex.py.

◆ search_url

str searx.engines.hex.search_url = "https://hex.pm/api/packages/"

Definition at line 23 of file hex.py.

◆ sort_criteria

str searx.engines.hex.sort_criteria = "recent_downloads"

Definition at line 25 of file hex.py.