Skip to content

Commit af84700

Browse files
author
Gauvain Pocentek
committed
fix use of json() method from requests
1 parent 7631e5e commit af84700

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

gitlab.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ def credentials_auth(self):
8989
r = self.rawPost('/session',
9090
{'email': self.email, 'password': self.password})
9191
if r.status_code == 201:
92-
self.user = CurrentUser(self, r.json)
92+
self.user = CurrentUser(self, r.json())
9393
else:
94-
raise GitlabAuthenticationError(r.json['message'])
94+
raise GitlabAuthenticationError(r.json()['message'])
9595

9696
self.private_token = self.user.private_token
9797

@@ -157,7 +157,7 @@ def list(self, obj_class, **kwargs):
157157
cls = obj_class
158158
if obj_class._returnClass:
159159
cls = obj_class._returnClass
160-
l = [cls(self, item) for item in r.json]
160+
l = [cls(self, item) for item in r.json()]
161161
if kwargs:
162162
for k, v in kwargs.items():
163163
if k in ('page', 'per_page'):
@@ -166,7 +166,7 @@ def list(self, obj_class, **kwargs):
166166
obj.__dict__[k] = v
167167
return l
168168
elif r.status_code == 401:
169-
raise GitlabAuthenticationError(r.json['message'])
169+
raise GitlabAuthenticationError(r.json()['message'])
170170
else:
171171
raise GitlabGetError('%d: %s' % (r.status_code, r.text))
172172

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

194194
if r.status_code == 200:
195-
return r.json
195+
return r.json()
196196
elif r.status_code == 401:
197-
raise GitlabAuthenticationError(r.json['message'])
197+
raise GitlabAuthenticationError(r.json()['message'])
198198
else:
199199
raise GitlabGetError('%d: %s' % (r.status_code, r.text))
200200

@@ -212,7 +212,7 @@ def delete(self, obj):
212212
if r.status_code == 200:
213213
return True
214214
elif r.status_code == 401:
215-
raise GitlabAuthenticationError(r.json['message'])
215+
raise GitlabAuthenticationError(r.json()['message'])
216216
return False
217217

218218
def create(self, obj):
@@ -228,9 +228,9 @@ def create(self, obj):
228228
"Can't connect to GitLab server (%s)" % self._url)
229229

230230
if r.status_code == 201:
231-
return r.json
231+
return r.json()
232232
elif r.status_code == 401:
233-
raise GitlabAuthenticationError(r.json['message'])
233+
raise GitlabAuthenticationError(r.json()['message'])
234234
else:
235235
raise GitlabCreateError('%d: %s' % (r.status_code, r.text))
236236

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

254254
if r.status_code == 200:
255-
return r.json
255+
return r.json()
256256
elif r.status_code == 401:
257-
raise GitlabAuthenticationError(r.json['message'])
257+
raise GitlabAuthenticationError(r.json()['message'])
258258
else:
259259
raise GitlabUpdateError('%d: %s' % (r.status_code, r.text))
260260

0 commit comments

Comments
 (0)