feat(walmart): add billing units and rate config

This commit is contained in:
CREDO23 2026-07-19 08:19:21 +02:00
parent 32bb099025
commit 0d2c8df5bd
3 changed files with 12 additions and 0 deletions

View file

@ -41,6 +41,8 @@ _PLATFORM_RATE_KEYS: dict[BillingUnit, str] = {
BillingUnit.TIKTOK_VIDEO: "TIKTOK_MICROS_PER_VIDEO", BillingUnit.TIKTOK_VIDEO: "TIKTOK_MICROS_PER_VIDEO",
BillingUnit.TIKTOK_USER: "TIKTOK_MICROS_PER_USER", BillingUnit.TIKTOK_USER: "TIKTOK_MICROS_PER_USER",
BillingUnit.TIKTOK_COMMENT: "TIKTOK_MICROS_PER_COMMENT", BillingUnit.TIKTOK_COMMENT: "TIKTOK_MICROS_PER_COMMENT",
BillingUnit.WALMART_PRODUCT: "WALMART_MICROS_PER_PRODUCT",
BillingUnit.WALMART_REVIEW: "WALMART_MICROS_PER_REVIEW",
} }
@ -63,6 +65,8 @@ _UNIT_NOUNS: dict[BillingUnit, str] = {
BillingUnit.TIKTOK_VIDEO: "video", BillingUnit.TIKTOK_VIDEO: "video",
BillingUnit.TIKTOK_USER: "profile", BillingUnit.TIKTOK_USER: "profile",
BillingUnit.TIKTOK_COMMENT: "comment", BillingUnit.TIKTOK_COMMENT: "comment",
BillingUnit.WALMART_PRODUCT: "product",
BillingUnit.WALMART_REVIEW: "review",
} }

View file

@ -31,6 +31,8 @@ class BillingUnit(StrEnum):
TIKTOK_VIDEO = "tiktok_video" TIKTOK_VIDEO = "tiktok_video"
TIKTOK_USER = "tiktok_user" TIKTOK_USER = "tiktok_user"
TIKTOK_COMMENT = "tiktok_comment" TIKTOK_COMMENT = "tiktok_comment"
WALMART_PRODUCT = "walmart_product"
WALMART_REVIEW = "walmart_review"
class BillableInput(Protocol): class BillableInput(Protocol):

View file

@ -736,6 +736,12 @@ class Config:
# Comments are the cheapest per-item TikTok data, matching the per-comment # Comments are the cheapest per-item TikTok data, matching the per-comment
# market (and YouTube's comment meter). # market (and YouTube's comment meter).
TIKTOK_MICROS_PER_COMMENT = int(os.getenv("TIKTOK_MICROS_PER_COMMENT", "1500")) TIKTOK_MICROS_PER_COMMENT = int(os.getenv("TIKTOK_MICROS_PER_COMMENT", "1500"))
# Walmart products come from server-rendered JSON behind residential proxies,
# priced alongside Amazon's per-product meter.
WALMART_MICROS_PER_PRODUCT = int(os.getenv("WALMART_MICROS_PER_PRODUCT", "3500"))
# Reviews are 10 per page (many light requests per product), priced on the
# cheaper per-review market like the Google Maps review meter.
WALMART_MICROS_PER_REVIEW = int(os.getenv("WALMART_MICROS_PER_REVIEW", "1500"))
# Retry an empty listing draw on a fresh rotating IP. Set to 1 for a static # Retry an empty listing draw on a fresh rotating IP. Set to 1 for a static
# proxy, where every retry re-hits the same exit. # proxy, where every retry re-hits the same exit.
TIKTOK_LISTING_MAX_ATTEMPTS = int(os.getenv("TIKTOK_LISTING_MAX_ATTEMPTS", "3")) TIKTOK_LISTING_MAX_ATTEMPTS = int(os.getenv("TIKTOK_LISTING_MAX_ATTEMPTS", "3"))