> ## Documentation Index
> Fetch the complete documentation index at: https://docs.validio.io/llms.txt
> Use this file to discover all available pages before exploring further.

# validio_sdk.poll module

> Helpers related to source polls.

Helpers related to source polls.

### SourcePollInfo

```python
class validio_sdk.poll.SourcePollInfo(source_id: str, poll_id: str, poll_timestamp: datetime)
```

**Parameters**

**source\_id** `str` *required*

**poll\_id** `str` *required*

**poll\_timestamp** `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

```python
poll_id: str
```

#### poll\_timestamp

```python
poll_timestamp: datetime
```

#### source\_id

```python
source_id: str
```

### SourcePollResult

```python
class validio_sdk.poll.SourcePollResult(info: SourcePollInfo, error: Exception | None = None, has_incidents: bool | None = None)
```

**Parameters**

**info** `SourcePollInfo` *required*

**error** `Exception | None`

**has\_incidents** `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

```python
error: Exception | None = None
```

#### has\_incidents

```python
has_incidents: bool | None = None
```

#### info

```python
info: SourcePollInfo
```

### poll\_source()

```python
async validio_sdk.poll.poll_source(*, source_id_or_name: str, client: APIClient, namespace: str | None = None, poll_interval_seconds: float = 5.0, timeout_seconds: float | None = None) → SourcePollResult
```

**Parameters**

**source\_id\_or\_name** `str` *required*

**client** `APIClient` *required*

**namespace** `str | None`

**poll\_interval\_seconds** `float`

**timeout\_seconds** `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**](https://docs.validio.io/v10.1/sdk-reference/validio_sdk.md#validioerror "validio_sdk.exception.ValidioError") – If the source can’t be resolved or the poll can’t be started.

### wait\_until\_poll\_completion()

```python
async validio_sdk.poll.wait_until_poll_completion(*, client: APIClient, info: SourcePollInfo, poll_interval_seconds: float = 5.0, timeout_seconds: float | None = None) → SourcePollResult
```

**Parameters**

**client** `APIClient` *required*

**info** `SourcePollInfo` *required*

**poll\_interval\_seconds** `float`

**timeout\_seconds** `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.
