Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc02dabd

Browse files
author
Gauvain Pocentek
committed
Initial, non-functional v4 support
1 parentce3dd0d commitc02dabd

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

‎gitlab/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,10 @@ class Gitlab(object):
6969

7070
def__init__(self,url,private_token=None,email=None,password=None,
7171
ssl_verify=True,http_username=None,http_password=None,
72-
timeout=None):
72+
timeout=None,api_version='3'):
7373

74-
self._url='%s/api/v3'%url
74+
self._api_version=str(api_version)
75+
self._url='%s/api/v%s'% (url,api_version)
7576
#: Timeout to use for requests to gitlab server
7677
self.timeout=timeout
7778
#: Headers that will be used in request to GitLab
@@ -152,7 +153,8 @@ def from_config(gitlab_id=None, config_files=None):
152153
returnGitlab(config.url,private_token=config.token,
153154
ssl_verify=config.ssl_verify,timeout=config.timeout,
154155
http_username=config.http_username,
155-
http_password=config.http_password)
156+
http_password=config.http_password,
157+
api_version=config.api_version)
156158

157159
defauth(self):
158160
"""Performs an authentication.
@@ -212,7 +214,7 @@ def set_url(self, url):
212214
Args:
213215
url (str): Base URL of the GitLab server.
214216
"""
215-
self._url='%s/api/v3'%url
217+
self._url='%s/api/v%s'%(url,self._api_version)
216218

217219
def_construct_url(self,id_,obj,parameters,action=None):
218220
if'next_url'inparameters:

‎gitlab/config.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,12 @@ def __init__(self, gitlab_id=None, config_files=None):
8888
'http_password')
8989
exceptException:
9090
pass
91+
92+
self.api_version='3'
93+
try:
94+
self.api_version=self._config.get(self.gitlab_id,'api_version')
95+
exceptException:
96+
pass
97+
ifself.api_versionnotin ('3','4'):
98+
raiseGitlabDataError("Unsupported API version: %s"%
99+
self.api_version)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp