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

Commit01152da

Browse files
author
Gauvain Pocentek
committed
raise an exception on 401 return code
1 parentc4920ee commit01152da

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

‎gitlab.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ def list(self, objClass, **kwargs):
9696
forobjinl:
9797
obj.__dict__[k]=v
9898
returnl
99+
elifr.status_code==401:
100+
raiseGitlabAuthenticationError(r.json['message'])
99101
else:
100102
raiseGitlabGetError('%d: %s'%(r.status_code,r.text))
101103

@@ -120,6 +122,8 @@ def get(self, objClass, id, **kwargs):
120122
fork,vinkwargs.items():
121123
obj.__dict__[k]=v
122124
returnobj
125+
elifr.status_code==401:
126+
raiseGitlabAuthenticationError(r.json['message'])
123127
else:
124128
raiseGitlabGetError('%d: %s'%(r.status_code,r.text))
125129

@@ -137,6 +141,8 @@ def delete(self, objClass, id, **kwargs):
137141

138142
ifr.status_code==200:
139143
returnTrue
144+
elifr.status_code==401:
145+
raiseGitlabAuthenticationError(r.json['message'])
140146
returnFalse
141147

142148
defcreate(self,objClass,objData,**kwargs):
@@ -156,6 +162,8 @@ def create(self, objClass, objData, **kwargs):
156162
cls=objClass.returnClass
157163

158164
returncls(self,r.json)
165+
elifr.status_code==401:
166+
raiseGitlabAuthenticationError(r.json['message'])
159167
else:
160168
raiseGitlabCreateError('%d: %s'%(r.status_code,r.text))
161169

@@ -176,6 +184,8 @@ def update(self, objClass, id, objData, **kwargs):
176184
cls=objClass.returnClass
177185

178186
returncls(self,r.json)
187+
elifr.status_code==401:
188+
raiseGitlabAuthenticationError(r.json['message'])
179189
else:
180190
raiseGitlabUpdateError('%d: %s'%(r.status_code,r.text))
181191

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp