Skip to content

Commit cf8b4bc

Browse files
committed
Python is not Java
1 parent d261520 commit cf8b4bc

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

custom_components/nissan_connect/kamereon.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -621,15 +621,16 @@ def __init__(self, region):
621621
# ugly hack
622622
os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '1'
623623

624-
def login(self):
625-
"""Login with cached credentials."""
626-
return self.login(self._username, self._password)
627-
628-
def login(self, username, password):
629-
# Cache credentials
630-
self._username = username
631-
self._password = password
632-
624+
def login(self, username=None, password=None):
625+
if username is not None and password is not None:
626+
# Cache credentials
627+
self._username = username
628+
self._password = password
629+
else:
630+
# Use cached credentials
631+
username = self._username
632+
password = self._password
633+
633634
# Reset session
634635
self.session = requests.session()
635636

0 commit comments

Comments
 (0)