Skip to main content

sumologic-cse-python-sdk

A Python SDK for the Sumo Logic Cloud SIEM (CSE) API. This client provides useful functionality for common Cloud SIEM use cases rather than being a comprehensive API client.

API Documentation: https://api.sumologic.com/docs/sec/#

Requirements

  • Python 3.9 or higher
  • Sumo Logic Cloud SIEM access credentials

Installation

Using pip

pip install sumologiccse
uv add sumologiccse

Getting Started

See the scripts section for examples. Configure your credentials using either:

Environment Variables:

export SUMO_ACCESS_ID="your_access_id"
export SUMO_ACCESS_KEY="your_access_key"

Or provide as arguments when creating the client.

Endpoints

See: https://help.sumologic.com/docs/api/getting-started/#which-endpoint-should-i-should-use

The default endpoint is: https://api.sumologic.com/docs/sec
Using --endpoint 'prod' or 'us1' will also resolve to this value.

For other endpoints, use the short form name:

--endpoint 'us2'
--endpoint 'au' 
--endpoint 'in'

Usage

Create a Connection

from sumologiccse.sumologiccse import SumoLogicCSE

# Using environment variables
cse = SumoLogicCSE(endpoint='us2')

# Or with explicit credentials
cse = SumoLogicCSE(
    endpoint='us2',
    access_id='your_access_id',
    access_key='your_access_key'
)

Query Insights

q = '-status:"closed" created:>2022-11-17T00:00:00+00:00'
insights = cse.get_insights(q=q)

Direct API Calls

You can call any API endpoint directly:

statuses = cse.get('/insight-status')

Development Setup

# Clone the repository
git clone https://github.com/rjury-sumo/sumologic-cse-python-sdk.git
cd sumologic-cse-python-sdk

# Install with development dependencies
uv sync --dev

# Run tests
uv run pytest

# Format code
uv run black .

# Lint code  
uv run ruff check .

# Type checking
uv run mypy src/

Using traditional pip

pip install -e ".[dev]"
pytest
black .
ruff check .
mypy src/

Publishing (for maintainers)

# Build the package
uv run python -m build

# Upload to PyPI (requires credentials)
uv run twine upload dist/*

# Upload to Test PyPI first (recommended)
uv run twine upload --repository testpypi dist/*

Example Use Case Scripts

Find example scripts in ./scripts/:

Docker

Build the Docker image:

docker build -t sumocse-test .

Run with environment variables:

docker run -it \
  -e SUMO_ACCESS_ID="$SUMO_ACCESS_ID" \
  -e SUMO_ACCESS_KEY="$SUMO_ACCESS_KEY" \
  sumocse-test bash

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes with tests
  4. Run the test suite: uv run pytest
  5. Format code: uv run black .
  6. Lint code: uv run ruff check .
  7. Submit a pull request

TODOs

  • Add comprehensive endpoint coverage
  • Expand unit and integration test suite
  • Add async support
  • Improve error handling and logging

Metadata

Release files for sumologiccse 0.2.1

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

Source distribution (sdist)

Source distribution for sumologiccse 0.2.1
File Size Uploaded Provenance Actions
sumologiccse-0.2.1.tar.gz 74.3 kB Without provenance Details for sumologiccse-0.2.1.tar.gz

Built distribution (wheel)

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

Total release size: 85.2 kB

Release files / sumologiccse-0.2.1.tar.gz

Download URL sumologiccse-0.2.1.tar.gz
Size 74.3 kB
Tags Source
SHA-256 checksum
How to use checksums
5b73b7e8744a60631f53f9b155b843fa12891b2b9bbdfa7f878301cff2432ec6
BLAKE2b-256 checksum
How to use checksums
79d34db590ac048284f0a3015642979d7c80fd5951dcd0562b78ab7d84488965
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / sumologiccse-0.2.1-py3-none-any.whl

Download URL sumologiccse-0.2.1-py3-none-any.whl
Size 10.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
40a83ce22e3f70d4ef4abf4d9cd5b899b9c918e669b79ebd83801a98180b6922
BLAKE2b-256 checksum
How to use checksums
8464965b35e8e7a53cb37319627e6692bd68be295fc156b1fa08ac364f50d0e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for sumologiccse 0.2.1

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