[ All integrations ](https://ohdear.app/third-party-integrations)

# Python SDK

Needs updating

A Python SDK to easily interact with the Oh Dear API from your Python applications.

[ owenvoke/ohdear-python-sdk ](https://github.com/owenvoke/ohdear-python-sdk)

by [ Owen Voke ](https://voke.dev)

The Python SDK provides a convenient way to interact with the Oh Dear API from Python applications. Built and maintained by Owen Voke, it offers full access to Oh Dear's monitoring capabilities.

## Installation [\#](#installation)

```
pip install ohdear-sdk
```

## Features [\#](#features)

The SDK supports all major Oh Dear API operations:

- **Authentication**: Validate credentials and retrieve account information
- **Site Management**: List and retrieve monitored websites
- **Broken Links**: Detect broken links across monitored sites
- **Certificate Health**: Check SSL certificate status
- **Cron Checks**: Monitor scheduled task execution
- **Mixed Content**: Identify mixed content issues
- **Domain Monitoring**: Track domain registration and expiry
- **Check Control**: Enable or disable specific monitoring checks

## Usage [\#](#usage)

```
<span class="hl-keyword">from</span> ohdear <span class="hl-keyword">import</span> OhDear

ohdear <span class="hl-operator">=</span> OhDear(<span class="hl-variable">api_token</span><span class="hl-operator">=</span><span class="hl-value">"your-api-token"</span>)

<span class="hl-comment"># Get all sites</span>
sites <span class="hl-operator">=</span> ohdear.sites.<span class="hl-type">all</span>()

<span class="hl-comment"># Get a specific site</span>
site <span class="hl-operator">=</span> ohdear.sites.show(site_id)

<span class="hl-comment"># Get broken links</span>
broken_links <span class="hl-operator">=</span> ohdear.broken_links.show(site_id)

<span class="hl-comment"># Get certificate health</span>
cert <span class="hl-operator">=</span> ohdear.certificate_health.show(site_id)
```

## Testing [\#](#testing)

The SDK uses `hatch` for testing:

```
hatch shell
hatch run test
```

For more details, see the [GitHub repository](https://github.com/owenvoke/ohdear-python-sdk).
