Skip to content

Latest commit

 

History

History
36 lines (28 loc) · 824 Bytes

File metadata and controls

36 lines (28 loc) · 824 Bytes

Python quickstart

Same flow as the Node example, in Python.

pip install requests
export RETAILERAPI_KEY=rk_live_…
python main.py
python main.py 194629116676

For typed responses, drop in Pydantic models:

from pydantic import BaseModel
from typing import Optional, List

class CrossRetailerCell(BaseModel):
    retailer: str
    status: str
    price: Optional[float] = None
    url: Optional[str] = None
    in_stock: Optional[bool] = None

class Product(BaseModel):
    item_id: str
    title: Optional[str] = None
    brand: Optional[str] = None
    current_price: Optional[float] = None
    walmart_url: Optional[str] = None
    cross_retailer: Optional[List[CrossRetailerCell]] = None

product = Product(**r.json())

Full reference: docs.retailerapi.com.