in src/cbs.pyx [0:0]
def __cinit__(self, const char* audience, const char* token_type, const char* token, stdint.uint64_t expires_at, cSession session, stdint.uint64_t timeout, const char* connection_id, stdint.uint64_t refresh_window):
self.state = AUTH_STATUS_IDLE
self.audience = audience
self.token_type = token_type
self.token = token
self.expires_at = expires_at
self.auth_timeout = timeout
self.connection_id = connection_id
self._token_put_time = 0
if refresh_window > 0:
self._refresh_window = refresh_window
else:
current_time = int(time.time())
remaining_time = expires_at - current_time
self._refresh_window = int(float(remaining_time) * 0.1)
self._cbs_handle = c_cbs.cbs_create(<c_session.SESSION_HANDLE>session._c_value)
self._session = session
if <void*>self._cbs_handle == NULL:
raise MemoryError("Unable to create CBS Handle.")
if c_cbs.cbs_open_async(self._cbs_handle, <c_cbs.ON_CBS_OPEN_COMPLETE>on_cbs_open_complete, <void*>self, <c_cbs.ON_CBS_ERROR>on_cbs_error, <void*>self) != 0:
raise ValueError("Unable to open CBS link.")