Skip to content

Commit

Permalink
api: pass the token in API calls
Browse files Browse the repository at this point in the history
Pass the token if set, otherwise the username/password.

Signed-off-by: Ross Burton <[email protected]>
  • Loading branch information
rossburton committed Nov 14, 2023
1 parent 1491627 commit b7b3bcb
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pwclient/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,9 +457,8 @@ def _generate_headers(self, additional_headers=None):
}

if self._token:
pass

if self._username:
headers['Authorization'] = f"Token {self._token}"
elif self._username and self._password:
credentials = base64.b64encode(
f'{self._username}:{self._password}'.encode('ascii')
).decode('ascii')
Expand Down

0 comments on commit b7b3bcb

Please sign in to comment.