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

Functions

 request (query, params)
 
 response (resp)
 

Variables

dict about
 
list categories = ['it', 'repos']
 
bool paging = True
 
str base_url = ""
 
str api_path = 'api/v4/projects'
 

Detailed Description

Engine to search in collaborative software platforms based on GitLab_ with
the `GitLab REST API`_.

.. _GitLab: https://about.gitlab.com/install/
.. _GitLab REST API: https://docs.gitlab.com/ee/api/

Configuration
=============

The engine has the following mandatory setting:

- :py:obj:`base_url`

Optional settings are:

- :py:obj:`api_path`

.. code:: yaml

  - name: gitlab
    engine: gitlab
    base_url: https://gitlab.com
    shortcut: gl
    about:
      website: https://gitlab.com/
      wikidata_id: Q16639197

  - name: gnome
    engine: gitlab
    base_url: https://gitlab.gnome.org
    shortcut: gn
    about:
      website: https://gitlab.gnome.org
      wikidata_id: Q44316

Implementations
===============

Function Documentation

◆ request()

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

Definition at line 67 of file gitlab.py.

67def request(query, params):
68 args = {'search': query, 'page': params['pageno']}
69 params['url'] = f"{base_url}/{api_path}?{urlencode(args)}"
70
71 return params
72
73

◆ response()

searx.engines.gitlab.response ( resp)

Definition at line 74 of file gitlab.py.

74def response(resp):
75 results = []
76
77 for item in resp.json():
78 results.append(
79 {
80 'template': 'packages.html',
81 'url': item.get('web_url'),
82 'title': item.get('name'),
83 'content': item.get('description'),
84 'thumbnail': item.get('avatar_url'),
85 'package_name': item.get('name'),
86 'maintainer': item.get('namespace', {}).get('name'),
87 'publishedDate': parser.parse(item.get('last_activity_at') or item.get("created_at")),
88 'tags': item.get('tag_list', []),
89 'popularity': item.get('star_count'),
90 'homepage': item.get('readme_url'),
91 'source_code_url': item.get('http_url_to_repo'),
92 }
93 )
94
95 return results

Variable Documentation

◆ about

dict searx.engines.gitlab.about
Initial value:
1= {
2 "website": None,
3 "wikidata_id": None,
4 "official_api_documentation": "https://docs.gitlab.com/ee/api/",
5 "use_official_api": True,
6 "require_api_key": False,
7 "results": "JSON",
8}

Definition at line 45 of file gitlab.py.

◆ api_path

str searx.engines.gitlab.api_path = 'api/v4/projects'

Definition at line 60 of file gitlab.py.

◆ base_url

str searx.engines.gitlab.base_url = ""

Definition at line 57 of file gitlab.py.

◆ categories

list searx.engines.gitlab.categories = ['it', 'repos']

Definition at line 54 of file gitlab.py.

◆ paging

bool searx.engines.gitlab.paging = True

Definition at line 55 of file gitlab.py.