Skip to content

stanislavulrych/opsgenie-python-api

Repository files navigation

opsgenie-python-api

Sync and async Python bindings for Opsgenie API.

Opsgenie API documentation: https://docs.opsgenie.com/docs/

Requirements

Python >= 3.12.

Installation

uv add opsgenie-python-api

Runtime dependency: httpx only.

Development

uv sync --extra dev
uv run pytest
uv run ruff check .

Getting Started

You need an API token for communicating with Opsgenie REST APIs.

Schedules API

from opsgenie import Schedules_v2

with Schedules_v2(token="<your_api_auth_token>") as client:
    users = client.get_users()
    schedules_list = client.get_schedules()
    rotations = client.get_schedule_rotations("<schedule-id>")
    overrides = client.get_schedule_overrides("<schedule-id>")
    timeline = client.get_schedule_timeline("<schedule-id>")

Async equivalent: from opsgenie import AsyncSchedules_v2 with async with / await.

Custom EU/US endpoint (HTTPS only):

with Schedules_v2(token="...", url="https://api.eu.opsgenie.com/v2/") as client:
    ...

Breaking changes in v0.3.0

Before After
from opsgenie.api.v2 import Schedules from opsgenie import Schedules_v2 or AsyncSchedules_v2
schedules.get_users() client.get_users() or await client.get_users()
atlassian-python-api httpx

Contributing

Contribution is welcome. See CONTRIBUTING.md for more details.

Releases

Packages

Used by

Contributors

Languages