Skip to main content

sentry-api-python

PyPI Python License

This project aims to simplify communication with Sentry REST API.

It is in quite early stage, our approach is simple. We cover first endpoints that we use for our tools. But new PRs are more than welcome.

Installation

pip install sentry-api-python

Example of use

Create project

from sentry_api.api import SentryApi

sentry_api = SentryApi(
    organization_slug="my-org",
    token="<Your Auth Token https://docs.sentry.io/api/auth/>",
)
response = sentry_api.projects.create(
    team_slug="backend",
    project=dict(name="My first project")
)

Create alert with Slack + Linear integration

from sentry_api.api import SentryApi

sentry_api = SentryApi(
    organization_slug="my-org",
    token="<Your Auth Token https://docs.sentry.io/api/auth/>",
    endpoint_url="https://sentry.io/api/0/",
)

response = sentry_api.project_rules.create(
    project_slug="my-first-project",
    rule={
        "name": "Prod issues",
        "owner": "team:<id of team>",
        "environment": "prod",
        "actionMatch": "any",
        "filterMatch": "all",
        "frequency": 10080,  # One week
        "conditions": [
            {"id": "sentry.rules.conditions.first_seen_event.FirstSeenEventCondition"},
            {"id": "sentry.rules.conditions.regression_event.RegressionEventCondition"},
        ],
        "actions": [
            {
                "workspace": "<slack workspace>",
                "id": "sentry.integrations.slack.notify_action.SlackNotifyServiceAction",
                "channel": "#alerts-production",
                "channel_id": "<https://docs.sentry.io/product/integrations/notification-incidents/slack/#rate-limiting-error>",
            },
            {
                "id": "sentry.rules.actions.notify_event_sentry_app.NotifyEventSentryAppAction",
                "sentryAppInstallationUuid": "<app installation here>",
                "settings": [
                    {"name": "teamId", "value": "<linear team id>"},
                    {"name": "assigneeId", "value": ""},
                    {"name": "labelId", "value": "<label id>"},
                    {"name": "projectId", "value": ""},
                    {"name": "stateId", "value": "<state id>"},
                    {"name": "priority", "value": "1"},
                ],
                "hasSchemaFormConfig": True,
            },
        ],
    },
)
print(response.json())

Metadata

Release files for sentry-api-python 0.3.0

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

Source distribution (sdist)

Source distribution for sentry-api-python 0.3.0
File Size Uploaded Provenance
sentry_api_python-0.3.0.tar.gz 4.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for sentry-api-python 0.3.0
File Interpreter ABI Platform
sentry_api_python-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.2 kB

Release files / sentry_api_python-0.3.0.tar.gz

Download URL sentry_api_python-0.3.0.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
00cf028f2b2712d6779a0b84da91fef5fedf86b22ee5ce4f790e598d2c1f45a0
BLAKE2b-256 checksum
How to use checksums
b4c3b8ae8a2dab45490569c43e8fe0deef267c7f2112f48f0001875a7f0d48c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.0 CPython/3.8.16 Linux/5.15.0-1033-azure

Release files / sentry_api_python-0.3.0-py3-none-any.whl

Download URL sentry_api_python-0.3.0-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ea38ed70eb915f8265205a5633f6b0a371aaee7e56e874a05294790b98a9c7d8
BLAKE2b-256 checksum
How to use checksums
3c0e8a9b5b4362f7ab1c7f8a646a6f73dacbb7c51cbb7cc3a32976d919943d05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.0 CPython/3.8.16 Linux/5.15.0-1033-azure

Security for sentry-api-python 0.3.0

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.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files No provenance

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