Skip to content
This repository was archived by the owner on Oct 29, 2023. It is now read-only.

Commit c0caddd

Browse files
authored
Feature/logout (#92)
* added logout cli command * expanduser and resolve
1 parent 1f2fb14 commit c0caddd

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

n26/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ def get_token(self):
461461

462462
return self.token_data[ACCESS_TOKEN_KEY]
463463

464-
def _request_token(self, username: str, password: str):
464+
def _request_token(self, username: str, password: str) -> dict:
465465
"""
466466
Request an authentication token from the server
467467
:return: the token or None if the response did not contain a token

n26/cli.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from tabulate import tabulate
1010

1111
import n26.api as api
12+
from n26.config import Config
1213
from n26.const import AMOUNT, CURRENCY, REFERENCE_TEXT, ATM_WITHDRAW, CARD_STATUS_ACTIVE, DATETIME_FORMATS
1314

1415
LOGGER = logging.getLogger(__name__)
@@ -61,6 +62,17 @@ def cli(json: bool):
6162
JSON_OUTPUT = json
6263

6364

65+
@cli.command()
66+
@auth_decorator
67+
def logout():
68+
""" Logout """
69+
cfg = Config()
70+
login_data_file = cfg.LOGIN_DATA_STORE_PATH.value
71+
if login_data_file is not None:
72+
login_data_file = login_data_file.expanduser().resolve()
73+
login_data_file.unlink(missing_ok=True)
74+
75+
6476
@cli.command()
6577
@auth_decorator
6678
def addresses():

0 commit comments

Comments
 (0)