Skip to content

Commit

Permalink
docs: add docs and examples for custom user agent
Browse files Browse the repository at this point in the history
  • Loading branch information
nejch committed Jan 31, 2021
1 parent c5a37e7 commit a69a214
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/api-usage.rst
Expand Up @@ -26,6 +26,9 @@ To connect to a GitLab server, create a ``gitlab.Gitlab`` object:
# anonymous gitlab instance, read-only for public resources
gl = gitlab.Gitlab('http://10.0.0.1')
# Define your own custom user agent for requests
gl = gitlab.Gitlab('http://10.0.0.1', user_agent='my-package/1.0.0')
# make an API request to create the gl.user object. This is mandatory if you
# use the username/password authentication.
gl.auth()
Expand Down
3 changes: 3 additions & 0 deletions docs/cli-usage.rst
Expand Up @@ -78,6 +78,9 @@ parameters. You can override the values in each GitLab server section.
- Integer between 1 and 100
- The number of items to return in listing queries. GitLab limits the
value at 100.
* - ``user_agent``
- ``str``
- A string defining a custom user agent to use when ``gitlab`` makes requests.

You must define the ``url`` in each GitLab server section.

Expand Down
1 change: 1 addition & 0 deletions gitlab/__init__.py
Expand Up @@ -65,6 +65,7 @@ class Gitlab(object):
api_version (str): Gitlab API version to use (support for 4 only)
pagination (str): Can be set to 'keyset' to use keyset pagination
order_by (str): Set order_by globally
user_agent (str): A custom user agent to use for making HTTP requests.
"""

def __init__(
Expand Down

0 comments on commit a69a214

Please sign in to comment.