Skip to content

Commit 10c2f13

Browse files
authored
Merge pull request #2863 from rleidner/soc_bmw_p7
soc_i3: fix issue with uninitialized session_id
2 parents 0a05738 + 0854bd1 commit 10c2f13

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

modules/soc_i3/i3soc.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,16 +455,16 @@ def main():
455455
load_store()
456456
now = int(time.time())
457457
_debug('main0: store=\n' + json.dumps(store, indent=4))
458+
if 'session_id' not in store:
459+
store['session_id'] = str(uuid.uuid4())
460+
session_id = store['session_id']
458461
# if OK, check if refreshToken is required
459462
if 'expires_at' in store and \
460463
'Token' in store and \
461464
'expires_in' in store['Token'] and \
462465
'refresh_token' in store['Token']:
463466
expires_in = store['Token']['expires_in']
464467
expires_at = store['expires_at']
465-
if 'session_id' not in store:
466-
store['session_id'] = str(uuid.uuid4())
467-
session_id = store['session_id']
468468
token = store['Token']
469469
_exp_at = datetime.fromtimestamp(expires_at).strftime('%Y-%m-%d %H:%M:%S')
470470
_exp_at2 = datetime.fromtimestamp(expires_at-120).strftime('%Y-%m-%d %H:%M:%S')

0 commit comments

Comments
 (0)