Quickstart
This guide helps you begin using the Saner Python SDK in just a few steps. It demonstrates how to initialize the client, authenticate, and execute your first API request.
Step 1: Import the SDK
Start by importing the SanerClient class:
from saner import SanerClientSanerClient is one of three entry points the SDK provides: it's the universal client, giving you every resource nested under .platform/.cvem. This quick start uses it throughout since it always works regardless of which resources you end up needing; see the "Client Types" guide once you know your integration's scope, since PlatformClient/CvemClient may be a better fit.
Step 2: Initialize the Client
Create a client instance using your API credentials and account identifier:
from saner import SanerClient
client = SanerClient(
api_key="YOUR_API_KEY",
accountid="YOUR_ACCOUNT_ID",
base_url="https://eu.saner.secpod.com"
)Required Parameters
| Parameter | Description |
|---|---|
| api_key | Your Saner API authentication key |
| accountid | Account name used to identify the user context |
Optional Parameter
| Parameter | Description |
|---|---|
| base_url | Regional Saner server endpoint (example: EU region, IN region) |
If base_url is not provided, the SDK uses the default production endpoint configuration (https://saner.secpod.com)
Tip:
api_key,accountid, andbase_urlcan also be set as environment variables (SANER_API_KEY,SANER_ACCOUNT_ID,SANER_BASE_URL) instead of passed as arguments, which is useful for CI pipelines and containers. If you keep these in a.envfile, load it withpython-dotenvbefore constructing the client; the SDK reads the process environment, not the file. See the Client Configuration guide for both.
Step 3: Call an API Resource
Once initialized, you can call any available resource method. For example, retrieving organization details:
response = client.platform.Organization.get(organization="secpod")
print(response)This request fetches information about the specified organization.
If the organization parameter is omitted, all accessible organizations are returned.
Alternative: Using a Scoped Client
If you already know your integration only needs platform resources (organizations, users, accounts) or only needs CVEM resources (vulnerability, patch, compliance), you can skip the .platform/.cvem nesting entirely by importing a scoped client instead:
from saner.platform import PlatformClient
client = PlatformClient(
api_key="YOUR_API_KEY",
accountid="YOUR_ACCOUNT_ID",
base_url="https://eu.saner.secpod.com"
)
response = client.Organization.get(organization="secpod")
print(response)Everything else (credentials, retries, logging) works identically. See the Client Types guide for the full comparison.
Example: Complete Working Script
Below is a minimal working example demonstrating a full SDK interaction:
from saner import SanerClient
client = SanerClient(
api_key="YOUR_API_KEY",
accountid="YOUR_ACCOUNT_ID",
base_url="https://eu.saner.secpod.com"
)
response = client.platform.Organization.get(organization="secpod")
print(response)This script:
- Authenticates using your API key
- Connects to the Saner platform
- Retrieves organization information
- Prints the API response
Common First-Run Errors
| Error | Cause | Fix |
|---|---|---|
ValueError: api_key must be provided or set via the SANER_API_KEY environment variable | api_key omitted from both the constructor and the SANER_API_KEY environment variable | Pass api_key="..." explicitly, or export SANER_API_KEY=... (see the "Client Configuration" guide) |
ValueError: accountid must be provided or set via the SANER_ACCOUNT_ID environment variable | Same issue, for accountid | Pass accountid="..." explicitly, or export SANER_ACCOUNT_ID=... |
SanerRequestError raised on the first call | Network failure, DNS failure, SSL certificate error, or the server is unreachable at base_url | Confirm base_url is correct for your region/deployment and that the host is reachable; see the "Error Handling Model" guide for how to catch and inspect this exception |
Response Handling
All SDK methods return structured JSON/Binary responses that can be used directly within automation workflows.
Example:
{'organizations': [{'organizationinfo': {'email': '[email protected]',
'enddate': '2026-05-01',
'id': 'sp1rggggdggbxdle',
'inusesubscriptions': 1,
'maxsubscriptions': 50,
'name': 'Demo Organization',
'startdate': '2026-01-23'}}]}You can further process response data depending on your workflow requirements.
Next Steps
After completing the quick start setup, you can continue with:
- Choosing between SanerClient, PlatformClient, and CvemClient
- Client configuration options
- Logging setup
- Retry and timeout configuration
- Multi-account usage patterns
- Error handling behavior
Detailed SDK usage examples for individual APIs are available alongside each endpoint in the Saner API Reference documentation.
Updated about 9 hours ago
