Skip to content

Commit

Permalink
fix: name '_credentialFile' is not defined
Browse files Browse the repository at this point in the history
This fixes an issue when CLIENT_ID, CLIENT_SECRET and REFRESH_TOKEN
are passed, or available from the environment.
  • Loading branch information
pjoomen committed Oct 10, 2024
1 parent fa8700b commit 2ea527a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lnetatmo.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,9 @@ def renew_token(self):
cred = {"CLIENT_ID":self._clientId,
"CLIENT_SECRET":self._clientSecret,
"REFRESH_TOKEN":self.refreshToken }
with open(self._credentialFile, "w") as f:
f.write(json.dumps(cred, indent=True))
if hasattr(type(self), "_credentialFile"):
with open(self._credentialFile, "w") as f:
f.write(json.dumps(cred, indent=True))
self._accessToken = resp['access_token']
self.expiration = int(resp['expire_in'] + time.time())

Expand Down

0 comments on commit 2ea527a

Please sign in to comment.