Skip to content

Commit a69a214

Browse files
committed
docs: add docs and examples for custom user agent
1 parent c5a37e7 commit a69a214

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

docs/api-usage.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ To connect to a GitLab server, create a ``gitlab.Gitlab`` object:
2626
# anonymous gitlab instance, read-only for public resources
2727
gl = gitlab.Gitlab('http://10.0.0.1')
2828
29+
# Define your own custom user agent for requests
30+
gl = gitlab.Gitlab('http://10.0.0.1', user_agent='my-package/1.0.0')
31+
2932
# make an API request to create the gl.user object. This is mandatory if you
3033
# use the username/password authentication.
3134
gl.auth()

docs/cli-usage.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ parameters. You can override the values in each GitLab server section.
7878
- Integer between 1 and 100
7979
- The number of items to return in listing queries. GitLab limits the
8080
value at 100.
81+
* - ``user_agent``
82+
- ``str``
83+
- A string defining a custom user agent to use when ``gitlab`` makes requests.
8184

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

gitlab/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ class Gitlab(object):
6565
api_version (str): Gitlab API version to use (support for 4 only)
6666
pagination (str): Can be set to 'keyset' to use keyset pagination
6767
order_by (str): Set order_by globally
68+
user_agent (str): A custom user agent to use for making HTTP requests.
6869
"""
6970

7071
def __init__(

0 commit comments

Comments
 (0)