Skip to content

Commit 611fc1d

Browse files
author
Adrien "ze" Urban
committed
json calls: for different request versions
1 parent 5caf017 commit 611fc1d

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

gitlab.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ def credentials_auth(self):
114114
r = self.rawPost('/session',
115115
{'email': self.email, 'password': self.password})
116116
if r.status_code == 201:
117-
self.user = CurrentUser(self, r.json())
117+
self.user = CurrentUser(self, r.json)
118118
else:
119-
raise GitlabAuthenticationError(r.json()['message'])
119+
raise GitlabAuthenticationError(r.json['message'])
120120

121121
self.setToken(self.user.private_token)
122122

@@ -208,7 +208,7 @@ def list(self, obj_class, **kwargs):
208208
cls = obj_class
209209
if obj_class._returnClass:
210210
cls = obj_class._returnClass
211-
l = [cls(self, item) for item in r.json() if item is not None]
211+
l = [cls(self, item) for item in r.json if item is not None]
212212
if kwargs:
213213
for k, v in kwargs.items():
214214
if k in ('page', 'per_page'):
@@ -217,7 +217,7 @@ def list(self, obj_class, **kwargs):
217217
obj.__dict__[k] = str(v)
218218
return l
219219
elif r.status_code == 401:
220-
raise GitlabAuthenticationError(r.json()['message'])
220+
raise GitlabAuthenticationError(r.json['message'])
221221
else:
222222
raise GitlabGetError('%d: %s' % (r.status_code, r.text))
223223

@@ -243,9 +243,9 @@ def get(self, obj_class, id=None, **kwargs):
243243
"Can't connect to GitLab server (%s)" % self._url)
244244

245245
if r.status_code == 200:
246-
return r.json()
246+
return r.json
247247
elif r.status_code == 401:
248-
raise GitlabAuthenticationError(r.json()['message'])
248+
raise GitlabAuthenticationError(r.json['message'])
249249
elif r.status_code == 404:
250250
raise GitlabGetError("Object doesn't exist")
251251
else:
@@ -266,9 +266,9 @@ def delete(self, obj):
266266
if r.status_code == 200:
267267
return True
268268
elif r.status_code == 401:
269-
raise GitlabAuthenticationError(r.json()['message'])
269+
raise GitlabAuthenticationError(r.json['message'])
270270
else:
271-
raise GitlabDeleteError(r.json()['message'])
271+
raise GitlabDeleteError(r.json['message'])
272272
return False
273273

274274
def create(self, obj):
@@ -292,9 +292,9 @@ def create(self, obj):
292292
"Can't connect to GitLab server (%s)" % self._url)
293293

294294
if r.status_code == 201:
295-
return r.json()
295+
return r.json
296296
elif r.status_code == 401:
297-
raise GitlabAuthenticationError(r.json()['message'])
297+
raise GitlabAuthenticationError(r.json['message'])
298298
else:
299299
raise GitlabCreateError('%d: %s' % (r.status_code, r.text))
300300

@@ -319,9 +319,9 @@ def update(self, obj):
319319
"Can't connect to GitLab server (%s)" % self._url)
320320

321321
if r.status_code == 200:
322-
return r.json()
322+
return r.json
323323
elif r.status_code == 401:
324-
raise GitlabAuthenticationError(r.json()['message'])
324+
raise GitlabAuthenticationError(r.json['message'])
325325
else:
326326
raise GitlabUpdateError('%d: %s' % (r.status_code, r.text))
327327

@@ -371,7 +371,7 @@ def _list_projects(self, url, **kwargs):
371371
raise GitlabListError
372372

373373
l = []
374-
for o in r.json():
374+
for o in r.json:
375375
l.append(Project(self, o))
376376

377377
return l
@@ -745,7 +745,7 @@ def diff(self):
745745
{'project_id': self.project_id, 'commit_id': self.id}
746746
r = self.gitlab.rawGet(url)
747747
if r.status_code == 200:
748-
return r.json()
748+
return r.json
749749

750750
raise GitlabGetError
751751

@@ -1013,7 +1013,7 @@ def tree(self, path='', ref_name=''):
10131013
url += '?path=%s&ref_name=%s' % (path, ref_name)
10141014
r = self.gitlab.rawGet(url)
10151015
if r.status_code == 200:
1016-
return r.json()
1016+
return r.json
10171017

10181018
raise GitlabGetError
10191019

0 commit comments

Comments
 (0)