Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

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.