# ShopSavvy Python SDK

> A fully-typed Python client for the ShopSavvy Data API. Search products, compare prices across retailers, track price history, and schedule monitoring — all from Python.

*Source: https://shopsavvy.com/integrations/sdk-python*

- **Type:** SDK (SDKs)
- **Language:** Python
- **Status:** live
- **Repository:** https://github.com/shopsavvy/sdk-python (MIT)
- **Package:** https://pypi.org/project/shopsavvy-sdk/

## Setup

### 1. Get a ShopSavvy Data API key

Create a key at shopsavvy.com/data. Keys look like ss_live_ followed by 32 characters. Keep it out of source control.

### 2. Install

Add the ShopSavvy SDK to your project:

```bash
pip install shopsavvy-sdk
```

### 3. Add your API key

Set the SHOPSAVVY_API_KEY environment variable to your key (shell, .env file or your secrets manager), or pass it to the client as the README shows.

### 4. Make your first call

From the shopsavvy/sdk-python README (30-Second Example):

```python
from shopsavvy import create_client

# Initialize the client
api = create_client("ss_live_your_api_key_here")

# Look up any product by barcode, ASIN, or URL
product = api.get_product_details("012345678901")
print(f"📦 {product.data.name} by {product.data.brand}")

# Get current prices from all retailers
offers = api.get_current_offers("012345678901")
cheapest = min(offers.data, key=lambda x: x.price)
print(f"💰 Best price: ${cheapest.price} at {cheapest.retailer}")

# Set up price monitoring
api.schedule_product_monitoring("012345678901", "daily")
print("🔔 Price alerts activated!")
```

### 5. Environment Setup

From the shopsavvy/sdk-python README (Environment Setup):

```bash
# Optional: Store your API key securely
export SHOPSAVVY_API_KEY="ss_live_your_api_key_here"
```

### 6. Method 2 Configuration Object

From the shopsavvy/sdk-python README (Method 2 Configuration Object):

```python
from shopsavvy import ShopSavvyDataAPI, ShopSavvyConfig

config = ShopSavvyConfig(
    api_key="ss_live_your_api_key_here",
    timeout=45.0
)
api = ShopSavvyDataAPI(config)
```

## Features

- Fully typed with Pydantic models
- Async support with httpx
- Automatic retry with exponential backoff
- Rate limit handling
- All API endpoints covered

## Use Cases

- Build price comparison scripts
- Analyze pricing trends with pandas
- Automate product monitoring
- Power AI agents with product data

## What data, how often, which direction

- **Data:** Product records, current offers from tens of thousands of retailers and price history back to 2011, dense from 2019, from the ShopSavvy Data API. Prices are in US dollars.
- **How often:** Every offer carries the time it was last checked. With the Data API you can schedule refreshes hourly, daily or weekly for retailers we can re-check through an official retailer API; other retailers update as ShopSavvy sees them.
- **Direction:** ShopSavvy data flows into your code. Requests carry only what you ask about (identifiers, search terms or schedules) and your API key.

## FAQ

### Do I need an API key?
Yes. The Python SDK calls the ShopSavvy Data API, which needs a Data API key. Create one at shopsavvy.com/data, then add it as the setup steps above show.

### What data does it return?
ShopSavvy product records (title, brand, model, barcode, ASIN), current offers from tens of thousands of retailers with price, availability and condition, and price history back to 2011, dense from 2019. Products can be looked up by barcode, ASIN, URL or model number. Prices are in US dollars.

### How fresh are the prices?
Every offer carries the time ShopSavvy last checked it, so you can see how current each price is. Through the Data API you can schedule refreshes hourly, daily or weekly for retailers we can re-check through an official retailer API; other retailers update as ShopSavvy sees them.

### Is my API key stored securely?
The README has you supply it through the SHOPSAVVY_API_KEY environment variable or your own configuration, so it stays out of source code. The key is sent to the ShopSavvy API (api.shopsavvy.com) over HTTPS in the Authorization header. You can revoke a key and create a new one at shopsavvy.com/data/api-keys.

### Is it open source?
Yes. The source is on GitHub at https://github.com/shopsavvy/sdk-python under the MIT license.

## Related Integrations

- [LangChain](https://shopsavvy.com/integrations/langchain.md): LangChain tools for product search and price comparison
- [LlamaIndex](https://shopsavvy.com/integrations/llamaindex.md): LlamaIndex tool spec for product data retrieval
- [Haystack](https://shopsavvy.com/integrations/haystack.md): Haystack components for product search and price comparison

## Links

- Data API documentation: https://shopsavvy.com/data/documentation.md
- Data API plans: https://shopsavvy.com/data#pricing
- All integrations: https://shopsavvy.com/integrations.md
