diff options
Diffstat (limited to 'gitlab/__init__.py')
| -rw-r--r-- | gitlab/__init__.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gitlab/__init__.py b/gitlab/__init__.py index 3a36bf2..c0562da 100644 --- a/gitlab/__init__.py +++ b/gitlab/__init__.py @@ -555,6 +555,25 @@ class Gitlab(object): """ return self.http_request('delete', path, **kwargs) + @on_http_error(GitlabSearchError) + def search(self, scope, search, **kwargs): + """Search GitLab resources matching the provided string.' + + Args: + scope (str): Scope of the search + search (str): Search string + **kwargs: Extra options to send to the server (e.g. sudo) + + Raises: + GitlabAuthenticationError: If authentication is not correct + GitlabSearchError: If the server failed to perform the request + + Returns: + GitlabList: A list of dicts describing the resources found. + """ + data = {'scope': scope, 'search': search} + return self.http_list('/search', query_data=data, **kwargs) + class GitlabList(object): """Generator representing a list of remote objects. |
