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):
457
457
}
458
458
459
459
if self ._token :
460
- pass
461
-
462
- if self ._username :
460
+ headers ['Authorization' ] = f"Token { self ._token } "
461
+ elif self ._username and self ._password :
463
462
credentials = base64 .b64encode (
464
463
f'{ self ._username } :{ self ._password } ' .encode ('ascii' )
465
464
).decode ('ascii' )
Original file line number Diff line number Diff line change @@ -92,9 +92,12 @@ def main(argv=sys.argv[1:]):
92
92
if action in auth_actions :
93
93
if backend == 'rest' :
94
94
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
+ ):
98
101
sys .stderr .write (
99
102
"The %s action requires authentication, but no "
100
103
"username/password or\n "
You can’t perform that action at this time.
0 commit comments