Models

class sentrypy.models.BaseModel(transceiver: Transceiver, json: Dict)

Base class for all model classes like Project or Event.

Responsible for pythonic attribute access to API json responses.

If an API endpoint returns a response:

{
    "id": 42,
    "title": ...
}

every object child_object of an inheriting class allows to access the attributes like this:

# via dot, not working for keys that are not legal attribute names
child_object.id

# via brackets, works always
child_object["id"]

As BaseModel is inherited by all models, all children support this access styles.

json: Dict

Raw json data from API response.

Accessible via brackets [] and dot.access of object.

For more information see BaseModel documentation.

transceiver: Transceiver

HTTP level API wrapper.

class sentrypy.models.Event(transceiver: Transceiver, json: Dict)

Implements an Event

class sentrypy.models.EventCount(transceiver: sentrypy.transceiver.Transceiver, json: Dict)
class sentrypy.models.Integration(transceiver: Transceiver, json: Dict)

Implements an Integration

class sentrypy.models.Issue(transceiver: Transceiver, json: Dict, organization_slug: str)

Implements an Issue

events(full: bool = False) Iterator[Event]

Get an iterator of all Events of this Issue

Parameters:

full (bool) – If this is set to true then the event payload will include the full event body

Official API Docs

GET /api/0/organizations/{organization_slug}/issues/{issue_id}/events/

update(*, status: str | None = None, assigned_to: str | None = None, has_seen: bool | None = None, is_bookmarked: bool | None = None, is_subscribed: bool | None = None, is_public: bool | None = None) Issue

Update this issue

Only the attributes submitted are modified.

Parameters:
  • status (str) – The new status for the issues. Valid values are resolved, reprocessing, unresolved, and ignored.

  • assigned_to (str) – The actor id (or username) of the user or team that should be assigned to this issue.

  • has_seen (bool) – In case this API call is invoked with a user context this allows changing of the flag that indicates if the user has seen the event.

  • is_bookmarked (bool) – In case this API call is invoked with a user context this allows changing of the bookmark flag.

  • is_subscribed (bool) – In case this API call is invoked with a user context this allows the user to subscribe to workflow notifications for this issue.

  • is_public (bool) – Sets the issue to public or private.

Official API Docs

PUT /api/0/organizations/{self.organization_slug}/issues/{self.id}/

class sentrypy.models.Organization(transceiver: Transceiver, json: Dict)

Implements an Organization

create_team(team_slug: str) Team

Create a new Team

Parameters:

team_slug (str) – The slug of the team to create

Official API Docs

POST /api/0/organizations/{organization_slug}/teams/

integrations(provider_key: str | None = None, features: List[str] | None = None) Iterator[Integration]

Get an iterator over all or specific Integrations

Parameters:
  • provider_key (str) – Specific integration provider to filter by such as slack.

  • features (List[str]) – Integration features to filter by.

Official API Docs

GET /api/0/organizations/{organization_slug}/integrations/

issue(id: str) Issue

Get a specific Issue

Parameters:

id (str) – The ID of the issue to retrieve.

Official API Docs

GET /api/0/organizations/{organization_slug}/issues/{issue_id}/

project(project_slug: str) Project

Get a specific Project

Parameters:

project_slug (str) – The slug of the project to get

Official API Docs

GET /api/0/projects/{organization_slug}/{project_slug}/

team(team_slug: str) Team

Get a specific Team

Parameters:

team_slug (str) – The slug of the team to get

Official API Docs

GET /api/0/teams/{organization_slug}/{team_slug}/

teams() Iterator[Team]

Get an iterator over all Teams

Official API Docs

GET /api/0/organizations/{organization_slug}/teams/

class sentrypy.models.Project(transceiver: Transceiver, json: Dict)

Implements a Project

enum EventResolution(value)

Timespan to aggregate events counts

Allowed values specified by project endpoint.

Valid values are as follows:

SECONDS = <EventResolution.SECONDS: '10s'>
HOUR = <EventResolution.HOUR: '1h'>
DAY = <EventResolution.DAY: '1d'>
event_counts(resolution: EventResolution | None = None) List

Get event counts of project

Sentry endpoint documentation: https://docs.sentry.io/api/projects/retrieve-event-counts-for-a-project/

Parameters:

resolution – Aggregate counts according to set value of Project.EventResolution

issues(query: str | None = 'unresolved') Iterator[Issue]

Get an iterator of all or specified Issues in the Project

Parameters:

query (Optional[str]) – An optional Sentry structured search query. If explicitly set to None, an implied unresolved is assumed.

Official API Docs

GET /api/0/projects/{organization_slug}/{project_slug}/issues/

tag_values(key: str) List[Dict]

Get all tag values of the project

Parameters:

key (str) – The tag name to look up

Official API Docs

GET /api/0/projects/{organization_slug}/{project_slug}/tags/{key}/values/

update_issues(*, by_id: int | List[int] | None = None, by_status: str | None = None, status: str | None = None, status_details: str | None = None, ignore_duration: int | None = None, is_public: bool | None = None, merge: bool | None = None, assigned_to: str | None = None, has_seen: bool | None = None, is_bookmarked: bool | None = None) List

Update attributes of multiple issues of a project

If any IDs are out of scope this operation will succeed without any data mutation.

Parameters:
  • by_id (Optional[Union[int, List[int]]]) – A single ID or a list of IDs of the issues to be mutated. It is optional only if a status is mutated in which case an implicit update all is assumed.

  • by_status (Optional[str]) – Optionally limits the query to issues of the specified status. Valid values are resolved, reprocessing, unresolved, and ignored.

  • status (str) – The new status for the issues. Valid values are resolved, resolvedInNextRelease, unresolved, and ignored.

  • status_details (object) – Additional details about the resolution. Valid values are inRelease, inNextRelease, inCommit, ignoreDuration, ignoreCount, ignoreWindow, ignoreUserCount, and ignoreUserWindow.

  • ignore_duration (int) – The number of minutes to ignore this issue.

  • is_public (bool) – Sets the issue to public or private.

  • merge (bool) – Allows to merge or unmerge different issues.

  • assigned_to (str) – The actor ID (or username) of the user or team that should be assigned to this issue.

  • has_seen (bool) – In case this API call is invoked with a user context this allows changing of the flag that indicates if the user has seen the event.

  • is_bookmarked (bool) – In case this API call is invoked with a user context this allows changing of the bookmark flag.

Official API Docs

PUT /api/0/projects/{organization_slug}/{project_slug}/issues/

class sentrypy.models.Team(transceiver: Transceiver, json: Dict, organization_slug: str)

Implements a Team

delete()

Delete this Team

Official API Docs

DELETE /api/0/teams/{organization_slug}/{team_slug}/