Skip to content

Commit

Permalink
Expose additional properties for Gitlab objects
Browse files Browse the repository at this point in the history
* url: the URL provided by the user (from config or constructor)
* api_url: the computed base endpoint (URL/api/v?)

Fixes #474
  • Loading branch information
Gauvain Pocentek committed Mar 28, 2018
1 parent 32b399a commit f09089b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions gitlab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def __init__(self, url, private_token=None, oauth_token=None, email=None,

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
Expand Down Expand Up @@ -164,8 +165,19 @@ def __setstate__(self, state):
self._api_version)
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):
Expand Down

0 comments on commit f09089b

Please sign in to comment.