1- import json
1+ import json
22import threading
33import time
44import logging
@@ -128,8 +128,9 @@ def add(self, event, now=None):
128128 with self ._lock :
129129
130130 if access_token :
131- now = time .time () if now is None else now
132- expires_in = response .get ("expires_in" , 3599 )
131+ now = int (time .time ()) if now is None else int (now )
132+ expires_in = int (response .get ("expires_in" , 3599 ))
133+ ext_expires_in = int (response .get ("ext_expires_in" , expires_in ))
133134 at = {
134135 "credential_type" : self .CredentialType .ACCESS_TOKEN ,
135136 "secret" : access_token ,
@@ -138,10 +139,9 @@ def add(self, event, now=None):
138139 "client_id" : event .get ("client_id" ),
139140 "target" : target ,
140141 "realm" : realm ,
141- "cached_at" : str (int (now )), # Schema defines it as a string
142- "expires_on" : str (int (now + expires_in )), # Same here
143- "extended_expires_on" : str (int ( # Same here
144- now + response .get ("ext_expires_in" , expires_in ))),
142+ "cached_at" : str (now ), # Schema defines it as a string
143+ "expires_on" : str (now + expires_in ), # Same here
144+ "extended_expires_on" : str (now + ext_expires_in ) # Same here
145145 }
146146 self .modify (self .CredentialType .ACCESS_TOKEN , at , at )
147147
0 commit comments