Skip to main content

Cisco Secure Access Python SDK

A Python SDK for interacting with Cisco Secure Access APIs.

Requirements

  • Python 3.9 or higher
  • Valid API credentials

Installation

Prerequisites

First, install the required dependencies:

pip install -r requirements.txt

Setuptools

Install via Setuptools.

python setup.py install --user

Configuration

Set up your API credentials by using environment variables:

Environment Variables

export CLIENT_ID="your_client_id"
export CLIENT_SECRET="your_client_secret"

Retry Configuration

The SDK supports automatic retry with exponential backoff using urllib3's Retry class. Configure retries using the retries parameter in Configuration:

from urllib3.util.retry import Retry
from secure_access.configuration import Configuration
from secure_access.api_client import ApiClient

configuration = Configuration(
    access_token=access_token,
    retries=Retry(
        total=3,  # Maximum number of retry attempts
        backoff_factor=3,  # Wait time multiplier between retries: {backoff_factor} * (2 ** (retry_number - 1)) seconds. With factor=3: 0s, 3s, 6s delays
        status_forcelist=[429],  # HTTP status codes that trigger a retry (429 = Too Many Requests / rate limited)
        allowed_methods=["GET", "POST"]  # HTTP methods that are allowed to be retried
    )
)
api_client = ApiClient(configuration=configuration)

To disable retry, omit the retries parameter or set it to None.

Examples

The examples/ folder contains sample scripts demonstrating various use cases with the Cisco Secure Access SDK:

Access Rule Backup and Restore

Backup and restore access rules

python examples/access_rule_backup_restore.py -h
usage: access_rule_backup_restore.py [-h] -t {backup,restore} [-o OFFSET] [-l LIMIT] [-r RULES [RULES ...]]

Utility to backup and restore access rules

options:
  -h, --help            show this help message and exit
  -t {backup,restore}, --type {backup,restore}
                        Type of the operation to be performed i.e. either backup or restore the access rules.
  -o OFFSET, --offset OFFSET
                        Starting offset to fetch the access rules
  -l LIMIT, --limit LIMIT
                        limit to fetch the access rules in a call
  -r RULES [RULES ...], --rules RULES [RULES ...]
                        list of rule id's to filter the Access Rules

Roaming Computers Backup

Backup roaming computer configurations

python examples/roaming_computers_backup.py -h
usage: roaming_computers_backup.py [-h] --operation {backup,filter,complex-filter,analyze} [--page-size PAGE_SIZE] [--name NAME]
                                   [--status STATUS] [--swg-status SWG_STATUS] [--last-sync-before LAST_SYNC_BEFORE]
                                   [--last-sync-after LAST_SYNC_AFTER] [--filter-key FILTER_KEY] [--filter-value FILTER_VALUE]
                                   [--filter-expression FILTER_EXPRESSION] [--backup-file BACKUP_FILE] [--apply-simple-filter]
                                   [--apply-complex-filter]

Utility to backup roaming computers and apply filters

options:
  -h, --help            show this help message and exit
  --operation {backup,filter,complex-filter,analyze}
                        Operation to perform
  --page-size PAGE_SIZE
                        Number of records per page (max: 100)
  --name NAME           Filter by roaming computer name
  --status STATUS       Filter by DNS-layer security status
  --swg-status SWG_STATUS
                        Filter by Internet security (SWG) status
  --last-sync-before LAST_SYNC_BEFORE
                        Filter by last sync before this date (YYYY-MM-DD or YYYY-MM-DD HH:MM:SS)
  --last-sync-after LAST_SYNC_AFTER
                        Filter by last sync after this date (YYYY-MM-DD or YYYY-MM-DD HH:MM:SS)
  --filter-key FILTER_KEY
                        Key to filter on (supports dot notation for nested keys)
  --filter-value FILTER_VALUE
                        Value to match for filtering
  --filter-expression FILTER_EXPRESSION
                        Complex filter expression with logical operators and time functions
  --backup-file BACKUP_FILE
                        Custom backup file name
  --apply-simple-filter
                        Apply simple filter immediately after backup
  --apply-complex-filter
                        Apply complex filter immediately after backup

Destination Lists Manager

Manage destination lists

python examples/destination_lists_manager.py -h
usage: destination_list_manager.py [-h] {destination-lists,destinations} ...

Cisco Secure Access Destination Management Tool

positional arguments:
  {destination-lists,destinations}
                        Available commands
    destination-lists   Manage destination lists
    destinations        Manage destinations

options:
  -h, --help            show this help message and exit

Key Admin API Management

Manage API keys and administrative functions

python examples/key_admin_api.py

Cisco Cloud Security Development Samples

Introduction and Terms of Service

The following include examples and samples that can help you when interacting or building integrations with Cisco Secure Access. These samples, scripts, collections and guides are supplied to customers as examples which customers are free to use or modify for use with your existing subscriptions under the terms of the attached license and the Cisco DevNet Terms Of Service.

Metadata

Release files for secureaccess 2.0.202510221109

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for secureaccess 2.0.202510221109
File Size Uploaded Provenance Actions
secureaccess-2.0.202510221109.tar.gz 414.3 kB Without provenance Details for secureaccess-2.0.202510221109.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for secureaccess 2.0.202510221109
File Interpreter ABI Platform Actions
secureaccess-2.0.202510221109-py3-none-any.whl Python 3 none any Details for secureaccess-2.0.202510221109-py3-none-any.whl

Total release size: 1.8 MB

Release files / secureaccess-2.0.202510221109.tar.gz

Download URL secureaccess-2.0.202510221109.tar.gz
Size 414.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0238ae655bd94f5d6445855cc8ac737a4d75cfe804763f69c7d743feee3dd575
BLAKE2b-256 checksum
How to use checksums
26f569d70523e183deffb7e1029eda8d71e8dbc3cf50af32b341c71cd6788deb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.2 CPython/3.12.2 Darwin/25.3.0

Release files / secureaccess-2.0.202510221109-py3-none-any.whl

Download URL secureaccess-2.0.202510221109-py3-none-any.whl
Size 1.4 MB
Tags Python 3
SHA-256 checksum
How to use checksums
12c8a5c2322e99499e767e38b48c2ce251bb27039ace65aa8019e2a3191d0910
BLAKE2b-256 checksum
How to use checksums
1198f201f6614cd91528dbc5fc9f9b76eb4f291b04fbcc3ed2a07f750ec2f528
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.2 CPython/3.12.2 Darwin/25.3.0

Security for secureaccess 2.0.202510221109

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page