2424import requests .utils
2525
2626import gitlab .config
27+ from gitlab .__version__ import (
28+ __author__ ,
29+ __copyright__ ,
30+ __email__ ,
31+ __license__ ,
32+ __title__ ,
33+ __version__ ,
34+ )
2735from gitlab .const import * # noqa
2836from gitlab .exceptions import * # noqa
2937from gitlab import utils # noqa
3038from requests_toolbelt .multipart .encoder import MultipartEncoder
3139
3240
33- __title__ = "python-gitlab"
34- __version__ = "2.6.0"
35- __author__ = "Gauvain Pocentek"
36- __email__ = "gauvainpocentek@gmail.com"
37- __license__ = "LGPL3"
38- __copyright__ = "Copyright 2013-2019 Gauvain Pocentek"
39-
4041warnings .filterwarnings ("default" ,category = DeprecationWarning ,module = "^gitlab" )
4142
4243REDIRECT_MSG = (
@@ -64,6 +65,7 @@ class Gitlab(object):
6465 api_version (str): Gitlab API version to use (support for 4 only)
6566 pagination (str): Can be set to 'keyset' to use keyset pagination
6667 order_by (str): Set order_by globally
68+ user_agent (str): A custom user agent to use for making HTTP requests.
6769 """
6870
6971def __init__ (
@@ -81,6 +83,7 @@ def __init__(
8183per_page = None ,
8284pagination = None ,
8385order_by = None ,
86+ user_agent = USER_AGENT ,
8487 ):
8588
8689self ._api_version = str (api_version )
@@ -90,7 +93,7 @@ def __init__(
9093#: Timeout to use for requests to gitlab server
9194self .timeout = timeout
9295#: Headers that will be used in request to GitLab
93- self .headers = {"User-Agent" :"%s/%s" % ( __title__ , __version__ ) }
96+ self .headers = {"User-Agent" :user_agent }
9497
9598#: Whether SSL certificates should be validated
9699self .ssl_verify = ssl_verify
@@ -204,6 +207,7 @@ def from_config(cls, gitlab_id=None, config_files=None):
204207per_page = config .per_page ,
205208pagination = config .pagination ,
206209order_by = config .order_by ,
210+ user_agent = config .user_agent ,
207211 )
208212
209213def auth (self ):