From 2899a7e3af2f1e4d0c73a0a16790a5739d6a6cd8 Mon Sep 17 00:00:00 2001 From: David Croft Date: Sat, 2 Jul 2022 16:59:59 +0200 Subject: [PATCH 1/2] store path in self.path (currently it's always None) --- hmrc/auth/token.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hmrc/auth/token.py b/hmrc/auth/token.py index 6ce0f90..a8ac973 100644 --- a/hmrc/auth/token.py +++ b/hmrc/auth/token.py @@ -65,8 +65,9 @@ def __post_init__(self, path): # Open/create file if no explicit file was provided if self.file is None: - if path is None: - path = os.path.expanduser('~/.hmrc.token') + self.path = path + if self.path is None: + self.path = os.path.expanduser('~/.hmrc.token') fd = os.open(path, (os.O_RDWR | os.O_CREAT), (stat.S_IRUSR | stat.S_IWUSR)) self.file = open(fd, 'a+t', encoding='utf8') From 315771628e0df92fd95b6ca720eed554fdd4147e Mon Sep 17 00:00:00 2001 From: David Croft Date: Sat, 2 Jul 2022 16:59:59 +0200 Subject: [PATCH 2/2] store path in self.path (currently it's always None) --- hmrc/auth/token.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hmrc/auth/token.py b/hmrc/auth/token.py index 6ce0f90..04a665a 100644 --- a/hmrc/auth/token.py +++ b/hmrc/auth/token.py @@ -65,9 +65,10 @@ def __post_init__(self, path): # Open/create file if no explicit file was provided if self.file is None: - if path is None: - path = os.path.expanduser('~/.hmrc.token') - fd = os.open(path, (os.O_RDWR | os.O_CREAT), + self.path = path + if self.path is None: + self.path = os.path.expanduser('~/.hmrc.token') + fd = os.open(self.path, (os.O_RDWR | os.O_CREAT), (stat.S_IRUSR | stat.S_IWUSR)) self.file = open(fd, 'a+t', encoding='utf8')