Python SDK for Sumo Logic Cloud SIEM API
Project description
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
Using uv (recommended for development)
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
Using uv (recommended)
# 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:
- Fork the repository
- Create a feature branch
- Make your changes with tests
- Run the test suite:
uv run pytest - Format code:
uv run black . - Lint code:
uv run ruff check . - Submit a pull request
TODOs
- Add comprehensive endpoint coverage
- Expand unit and integration test suite
- Add async support
- Improve error handling and logging
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sumologiccse-0.2.1.tar.gz.
File metadata
- Download URL: sumologiccse-0.2.1.tar.gz
- Upload date:
- Size: 74.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b73b7e8744a60631f53f9b155b843fa12891b2b9bbdfa7f878301cff2432ec6
|
|
| MD5 |
3ed7260dcec855369b21947900b4b22a
|
|
| BLAKE2b-256 |
79d34db590ac048284f0a3015642979d7c80fd5951dcd0562b78ab7d84488965
|
File details
Details for the file sumologiccse-0.2.1-py3-none-any.whl.
File metadata
- Download URL: sumologiccse-0.2.1-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40a83ce22e3f70d4ef4abf4d9cd5b899b9c918e669b79ebd83801a98180b6922
|
|
| MD5 |
600105fb7f1faaeaad9dccf3b2425517
|
|
| BLAKE2b-256 |
8464965b35e8e7a53cb37319627e6692bd68be295fc156b1fa08ac364f50d0e3
|