Skip to content

Latest commit

 

History

History

README.md

FoxNose SDK Examples

This directory contains example scripts demonstrating how to use the FoxNose Python SDK.

Examples

File Description
basic_usage.py Getting started with the ManagementClient
async_client.py Using AsyncManagementClient for concurrent operations
resources_and_revisions.py Creating and managing content resources
folder_schema.py Defining folder schemas and fields
roles_and_permissions.py Managing RBAC roles and API keys
flux_client.py Using FluxClient for content delivery

Running the Examples

  1. Install the SDK:
pip install foxnose-sdk
  1. Set up your credentials. You can either:
    • Replace the placeholder values in the example files
    • Use environment variables:
export FOXNOSE_ACCESS_TOKEN="your-access-token"
export FOXNOSE_ENVIRONMENT_KEY="your-environment-key"
  1. Run an example:
python basic_usage.py

Authentication

The SDK supports multiple authentication methods:

JWT Authentication (Management API)

from foxnose_sdk.auth import JWTAuth

# From a static token
auth = JWTAuth.from_static_token("ACCESS_TOKEN")

# With refresh token support
auth = JWTAuth(
    access_token="ACCESS_TOKEN",
    refresh_token="REFRESH_TOKEN",
)

API Key Authentication (Flux API)

from foxnose_sdk.auth import APIKeyAuth

auth = APIKeyAuth("YOUR_API_KEY")

Error Handling

All API errors raise FoxNoseAPIError:

from foxnose_sdk.errors import FoxNoseAPIError

try:
    resource = client.get_resource(folder_key, resource_key)
except FoxNoseAPIError as e:
    print(f"Status: {e.status_code}")
    print(f"Message: {e.message}")
    print(f"Details: {e.details}")

Need Help?