File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -457,9 +457,8 @@ def _generate_headers(self, additional_headers=None):
457457 }
458458
459459 if self ._token :
460- pass
461-
462- if self ._username :
460+ headers ['Authorization' ] = f"Token { self ._token } "
461+ elif self ._username and self ._password :
463462 credentials = base64 .b64encode (
464463 f'{ self ._username } :{ self ._password } ' .encode ('ascii' )
465464 ).decode ('ascii' )
Original file line number Diff line number Diff line change @@ -92,9 +92,12 @@ def main(argv=sys.argv[1:]):
9292 if action in auth_actions :
9393 if backend == 'rest' :
9494 if not (
95- config .has_option (project_str , 'username' )
96- and config .has_option (project_str , 'password' )
97- ) or config .has_option (project_str , 'token' ):
95+ (
96+ config .has_option (project_str , 'username' )
97+ and config .has_option (project_str , 'password' )
98+ )
99+ or config .has_option (project_str , 'token' )
100+ ):
98101 sys .stderr .write (
99102 "The %s action requires authentication, but no "
100103 "username/password or\n "
You can’t perform that action at this time.
0 commit comments