summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain@pocentek.net>2018-03-28 07:57:47 +0200
committerGauvain Pocentek <gauvain@pocentek.net>2018-03-28 07:59:01 +0200
commitf09089b9bcf8be0b90de62e33dd9797004790204 (patch)
tree896acd9867a8e1263289c760cb9ce416f981d41a
parent32b399af0e506b38a10a2c625338848a03f0b35d (diff)
downloadgitlab-f09089b9bcf8be0b90de62e33dd9797004790204.tar.gz
Expose additional properties for Gitlab objects
* url: the URL provided by the user (from config or constructor) * api_url: the computed base endpoint (URL/api/v?) Fixes #474
-rw-r--r--gitlab/__init__.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/gitlab/__init__.py b/gitlab/__init__.py
index 17e60bc..1658c39 100644
--- a/gitlab/__init__.py
+++ b/gitlab/__init__.py
@@ -78,6 +78,7 @@ class Gitlab(object):
self._api_version = str(api_version)
self._server_version = self._server_revision = None
+ self._base_url = url
self._url = '%s/api/v%s' % (url, api_version)
#: Timeout to use for requests to gitlab server
self.timeout = timeout
@@ -165,7 +166,18 @@ class Gitlab(object):
self._objects = objects
@property
+ def url(self):
+ """The user-provided server URL."""
+ return self._base_url
+
+ @property
+ def api_url(self):
+ """The computed API base URL."""
+ return self._url
+
+ @property
def api_version(self):
+ """The API version used (3 or 4)."""
return self._api_version
def _cls_to_manager_prefix(self, cls):