session#
The following methods allow for interaction with the ZIA Authentication Session API endpoints.
Methods are accessible via zia.session
There is no need to manually create or delete a pyZscaler session, especially if you are using a
context handler such as with
. The example below shows correct usage of pyZscaler to print
the GRE tunnels configured in ZIA. The authenticated session will be automatically torn down by
pyZscaler after all the tunnels have been printed.
from pyzscaler.zia import ZIA
with ZIA() as zia:
for tunnel in zia.traffic.list_gre_tunnels():
print(tunnel)
- class AuthenticatedSessionAPI#
- create(api_key, username, password)#
Creates a ZIA authentication session.
- Parameters:
- Returns:
The authenticated session information.
- Return type:
Box
Examples
>>> zia.session.create(api_key='12khsdfh3289', ... username='admin@example.com', ... password='MyInsecurePassword')
- delete()#
Ends an authentication session.
- Returns:
The status code of the operation.
- Return type:
Examples
>>> zia.session.delete()
- status()#
Returns the status of the authentication session if it exists.
- Returns:
Session authentication information.
- Return type:
Box
Examples
>>> print(zia.session.status())