Metadata-Version: 2.4
Name: snapshot-site-sdk
Version: 0.1.0
Summary: Official Python SDK for the Snapshot Site API
Author: Snapshot Site
License-Expression: MIT
Project-URL: Homepage, https://snapshot-site.com/api-docs
Project-URL: Documentation, https://snapshot-site.com/api-docs
Project-URL: Source, https://github.com/snapshot-site/snapshot-site-python-sdk
Project-URL: Issues, https://github.com/snapshot-site/snapshot-site-python-sdk/issues
Keywords: snapshot-site,screenshot,visual-diff,api,python
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.31.0
Provides-Extra: dev
Requires-Dist: build>=1.2.2; extra == "dev"
Requires-Dist: pytest>=8.3.5; extra == "dev"
Dynamic: license-file

# Snapshot Site Python SDK

[![PyPI](https://img.shields.io/pypi/v/snapshot-site-sdk.svg)](https://pypi.org/project/snapshot-site-sdk/)
[![Python](https://img.shields.io/badge/python-%3E%3D3.9-3776AB.svg)](https://www.python.org/)
[![License](https://img.shields.io/github/license/snapshot-site/snapshot-site-python-sdk.svg?cacheSeconds=300)](https://github.com/snapshot-site/snapshot-site-python-sdk/blob/main/LICENSE)
[![CI](https://github.com/snapshot-site/snapshot-site-python-sdk/actions/workflows/tests.yml/badge.svg)](https://github.com/snapshot-site/snapshot-site-python-sdk/actions/workflows/tests.yml)

Official Python SDK for the Snapshot Site API.

## Install

```bash
pip install snapshot-site-sdk
```

Create your API token in Snapshot Site Console:

- https://console.snapshot-site.com

## Usage

```python
from snapshot_site import SnapshotSiteClient

client = SnapshotSiteClient(api_key="ss_live_xxx")

result = client.screenshot({
    "url": "https://snapshot-site.com",
    "format": "png",
    "fullSize": True,
})

print(result.get("link"))
```

## Screenshot example

```python
from snapshot_site import SnapshotSiteClient

client = SnapshotSiteClient(api_key="ss_live_xxx")

result = client.screenshot({
    "url": "https://snapshot-site.com/pricing",
    "width": 1440,
    "format": "png",
    "fullSize": True,
    "hideCookie": True,
})

print(result)
```

## Analyze example

```python
from snapshot_site import SnapshotSiteClient

client = SnapshotSiteClient(api_key="ss_live_xxx")

result = client.analyze({
    "url": "https://snapshot-site.com",
    "width": 1440,
    "fullSize": True,
    "enableSummary": True,
    "enableQuality": True,
})

print(result)
```

## Compare example

```python
from snapshot_site import SnapshotSiteClient

client = SnapshotSiteClient(api_key="ss_live_xxx")

result = client.compare({
    "before": {
        "url": "https://snapshot-site.com/pricing",
        "width": 1440,
        "fullSize": True,
        "hideCookie": True,
    },
    "after": {
        "url": "https://staging.snapshot-site.com/pricing",
        "width": 1440,
        "fullSize": True,
        "hideCookie": True,
    },
    "threshold": 0.1,
})

print(result)
```

## Download assets locally

```python
from snapshot_site import SnapshotSiteClient

client = SnapshotSiteClient(api_key="ss_live_xxx")

result = client.screenshot({
    "url": "https://snapshot-site.com/pricing",
    "format": "png",
    "fullSize": True,
})

client.download_to(result, "pricing.png")
```

## Custom base URL

```python
client = SnapshotSiteClient(
    api_key="ss_live_xxx",
    base_url="https://api.prod.ss.snapshot-site.com",
)
```

## Tests

```bash
python -m pip install -e .[dev]
pytest
```

## Build for PyPI

```bash
python -m pip install -e .[dev]
python -m build
```
