@@ -358,7 +358,7 @@ def set_token(self, token=None, oauth_token=None):
358
358
359
359
if oauth_token :
360
360
self .headers .pop ("PRIVATE-TOKEN" , None )
361
- self .headers ["Authorization" ] = "Bearer: %s" % oauth_token
361
+ self .headers ["Authorization" ] = "Bearer %s" % oauth_token
362
362
elif token :
363
363
self .headers .pop ("Authorization" , None )
364
364
self .headers ["PRIVATE-TOKEN" ] = token
@@ -397,16 +397,22 @@ def _raw_get(self, path_, content_type=None, streamed=False, **kwargs):
397
397
url = '%s%s' % (self ._url , path_ )
398
398
399
399
headers = self ._create_headers (content_type )
400
+
401
+ if 'Authorization' in self .headers :
402
+ auth = None
403
+ else :
404
+ auth = requests .auth .HTTPBasicAuth (
405
+ self .http_username ,
406
+ self .http_password )
407
+
400
408
try :
401
409
return self .session .get (url ,
402
410
params = kwargs ,
403
411
headers = headers ,
404
412
verify = self .ssl_verify ,
405
413
timeout = self .timeout ,
406
414
stream = streamed ,
407
- auth = requests .auth .HTTPBasicAuth (
408
- self .http_username ,
409
- self .http_password ))
415
+ auth = auth )
410
416
except Exception as e :
411
417
raise GitlabConnectionError (
412
418
"Can't connect to GitLab server (%s)" % e )
@@ -438,7 +444,7 @@ def _raw_list(self, path_, cls, extra_attrs={}, **kwargs):
438
444
results = [cls (self , item , ** params ) for item in r .json ()
439
445
if item is not None ]
440
446
if ('next' in r .links and 'url' in r .links ['next' ]
441
- and get_all_results is True ):
447
+ and get_all_results is True ):
442
448
args = kwargs .copy ()
443
449
args ['next_url' ] = r .links ['next' ]['url' ]
444
450
results .extend (self .list (cls , ** args ))
0 commit comments