Session.renew - Python API

Renews current session, returning its new expiration time on output (in UTC).

Note that the call will raise an exception if:

  • The session has already expired
  • The underlying user's password has already expired


renew(self, cid, current_ust, current_app, remote_addr, user_agent=None)

  • cid: Correlation ID used by audit log
  • current_ust: Current user's UST, the one to renew
  • current_app: Name of application the current user is issuing the call from
  • remote_addr: Current user's remote address
  • user_agent: User agent string
  • Returns: expiration_time - A datetime object representing the session's new expiration time
# -*- coding: utf-8 -*-

# Zato
from zato.server.service import Service

class RenewSession(Service):
    def handle(self):

        username = 'admin1'
        password = 'abxqDJpXMVXYEO8NOGx9nVZvv4xSew9-'
        current_app = 'CRM'
        remote_addr = ''
        user_agent = 'Firefox 139.0'

        # Log current user
        session = self.sso.user.login(username, password, current_app, remote_addr, user_agent)

        # Renew the session
        expiration = self.sso.user.session.renew(self.cid, session.ust, current_app, remote_addr)

        # Log result (in UTC)'Expiration`: %s, %s', expiration, type(expiration))
INFO - Expiration: 2023-03-14 15:24:39.361223, <type 'datetime.datetime'>