Skip to main content
Helpers related to source polls.

SourcePollInfo

Parameters
str
required
str
required
datetime
required
Bases: object Details about a poll that was started.
  • Variables:
    • source_id – The id of the source being polled.
    • poll_id – The id of the started poll.
    • poll_timestamp – The time at which the poll was initiated.

poll_id

poll_timestamp

source_id

SourcePollResult

Parameters
Exception | None
bool | None
Bases: object The outcome of polling a source.
  • Variables:
    • info – Details about the started poll. Can be passed to wait_until_poll_completion to resume waiting for the same poll.
    • error – Any error that occurred while waiting for the poll. When set, has_incidents is left unset.
    • has_incidents – Whether any new incidents were created while polling. Only set once the poll completed successfully.

error

has_incidents

info

poll_source()

Parameters
str
required
APIClient
required
str | None
float
float | None
Returns: SourcePollResult Manually poll a source and check if it produced new incidents. The source is polled with the sourceManualPoll API, we then wait for the poll to complete and finally check the incidents API for any incidents created since the poll started. Resolving the source and starting the poll raise on failure. Once the poll is started, waiting for it never raises; any error from that phase is returned on the result instead, along with the info that can be passed to wait_until_poll_completion to retry the waiting phase.
  • Parameters:
    • source_id_or_name – The id or the resource name of the source to poll. If a resource name is given it is resolved to its id.
    • client – The APIClient to use for the requests.
    • namespace – The namespace to look up the source in. Required when a resource name is given since resource names are only unique within a namespace. Ignored when an id is given.
    • poll_interval_seconds – How long to wait between progress checks. The progress API is rate limited so this should not be too low.
    • timeout_seconds – Maximum time to wait for the poll to complete. If None we wait indefinitely.
  • Returns: A SourcePollResult describing the outcome.
  • Raises: ValidioError – If the source can’t be resolved or the poll can’t be started.

wait_until_poll_completion()

Parameters
APIClient
required
float
float | None
Returns: SourcePollResult Wait for an already started poll to complete and check for incidents. This is the second phase of poll_source and can be used to resume waiting for a poll that was already started, e.g. to retry after a timeout. Errors are returned as part of the result rather than raised.
  • Parameters:
    • client – The APIClient to use for the requests.
    • info – Details about the started poll, as returned in a SourcePollResult.
    • poll_interval_seconds – How long to wait between progress checks. The progress API is rate limited so this should not be too low.
    • timeout_seconds – Maximum time to wait for the poll to complete. If None we wait indefinitely.
  • Returns: A SourcePollResult describing the outcome.