How the API answers
Look up an Amazon product by ASIN and get the influencers whose videos, photos or idea lists carry it, with the evidence for each match.
Answers come from Spreesy's index of Amazon influencer storefronts, never a live Amazon check.
One result is one influencer returned, with its evidence. Empty pages, and retries with the same Idempotency-Key, are free. The plan includes 25,000 results each billing month; extra results come in packs of 10,000.
- Endpoint
GET /api/v1/products/{asin}/influencers- Base URL
https://spreesy.com- Version
v1- OpenAPI 3.1
- Download the document as JSON
Every example on this page is fictional: no real influencer, product or observation appears in it.
Keys and Idempotency-Key
An API key from your account's API page. Send it from your server, never from a browser, a URL or a log.
Authorization: Bearer <your API key> Idempotency-Key: <a new ID for each page>
Keys look like this: spreesy_api_ followed by 40 letters and digits.
Each matching storefront appears once, with distinct content counts, up to 5 evidence items and coverage by kind. Page through with next_cursor. Send a new Idempotency-Key for each page and reuse it only to retry that page: within 24 hours a retry returns the stored answer, free.
Request parameters
GET https://spreesy.com/api/v1/products/{asin}/influencers| Parameter | Type | Meaning |
|---|---|---|
asinpath, required | string | The Amazon product: ten letters or digits, in any case.Pattern ^[A-Za-z0-9]{10}$ |
marketplacequery, required | "US" | The Amazon marketplace, in any case. Another answers unsupported_marketplace, never a silent switch. |
typequery, optional | "all" | "video" | "photo" | "list"default "all" | Which evidence counts: every kind, or videos, photos or idea lists only. Counts, evidence and results follow it. |
limitquery, optional | integer1 to 50, default 20 | Influencer results per page. |
cursorquery, optional | stringup to 512 characters | The previous page's next_cursor, with the same marketplace, type and limit. It lasts 24 hours.Pattern ^[A-Za-z0-9._-]+$ |
Idempotency-Keyheader, required | string | Your ID for this page request: new for each page, reused only to retry it.Pattern ^[A-Za-z0-9._:-]{8,128}$ |
Response fields
Influencers featuring a product: a page of influencers, possibly empty, as one JSON object.
InfluencersPage
| Field | Type | Meaning |
|---|---|---|
request_id | string | This answer's ID, to quote to support. A replay repeats the original's. |
query | object | The request as normalized. |
query.asin | string | The ASIN, uppercased. |
query.marketplace | "US" | - |
query.type | "all" | "video" | "photo" | "list" | - |
match_kind | "exact" | Only exact ASIN matches: never a variation or a similar product. |
data | Result[]up to 50 items | Each matching storefront once, in storefront identity order. |
pagination | object | - |
pagination.limit | integer1 to 50 | - |
pagination.next_cursor | string | nullup to 512 characters | Pass it as cursor for the next page, with the same parameters; null on the last page. |
meta | object | - |
meta.source | "indexed" | Read from Spreesy's index, never a live Amazon check. |
meta.result_status | "matches" | "no_indexed_matches" | no_indexed_matches: no indexed influencer carries the product, which is not evidence that nobody features it. |
meta.generated_at | stringdate-time | When this answer was generated: not when anything was observed. |
usage | object | - |
usage.unit | "influencer_result" | - |
usage.charged | integer0 to 50 | Results charged by this call: one for each influencer returned; 0 for an empty page or a replay. |
usage.replayed | boolean | This is the stored answer to an earlier call with the same Idempotency-Key. |
Result
| Field | Type | Meaning |
|---|---|---|
influencer | Influencer | - |
matching_content_counts | { video, photo, list }: integer | Distinct indexed items of each requested kind that carry the ASIN: not the storefront's total content. Kinds outside type are left out, never zero. |
evidence | Evidence[]up to 5 items | Up to 5 matching items across kinds: the most recently observed item of each kind first, in video, photo, list order, then the rest by relationship_observed_at, newest first. Retries return the same order. |
evidence_has_more | boolean | More indexed matching items exist than the evidence shows. It says nothing about content Spreesy has not indexed. |
coverage | { video, photo, list }: Coverage | How much of this storefront's content of each requested kind Spreesy has read. |
Influencer
| Field | Type | Meaning |
|---|---|---|
id | string | One storefront in one marketplace, stable across handle changes. It does not identify a person across countries. |
handle | string | The storefront's current handle. |
name | string | nullup to 200 characters | The storefront's display name. |
storefront_url | stringuri | The influencer's Amazon storefront. |
avatar_url | string | nullup to 1000 characters, uri | An image on Amazon's image hosts. |
social_links | SocialLink[]up to 10 items | Links from the influencer's public Amazon storefront page only. |
profile_checked_at | string | nulldate-time | When the storefront profile (name, avatar, links) was last read. |
SocialLink
| Field | Type | Meaning |
|---|---|---|
platform | "facebook" | "instagram" | "pinterest" | "tiktok" | "twitter" | "youtube" | - |
url | stringuri | The profile link; x.com links are twitter. |
source | "amazon_storefront" | - |
Evidence
| Field | Type | Meaning |
|---|---|---|
id | string | Amazon's own identity of the item. |
type | "video" | "photo" | "list" | - |
title | string | nullup to 300 characters | The captured title. Photos have none. |
url | string | nulluri | The video's or idea list's Amazon page. Photos have none; never the storefront in its place. |
thumbnail_url | string | nullup to 1000 characters, uri | An image on Amazon's image hosts, never a video file. |
relationship_observed_at | string | nulldate-time | When this item's association with the ASIN was observed: not the profile check, the item's publication or the request. |
Coverage
| Field | Type | Meaning |
|---|---|---|
status | "complete" | "partial" | "unknown" | complete: the whole directory and every item's product tags were read; partial: some of it; unknown: none, or the marketplace does not collect the kind. It describes Spreesy's index only. |
checked_at | string | nulldate-time | When the directory behind this status was read; null when unknown. |
Error codes
Every error has one shape, and none carries influencer data or charges a result.
| Field | Type | Meaning |
|---|---|---|
error.code | string | The error, from the table below. |
error.message | string | What to do, in English. |
error.request_id | string | This answer's ID, to quote to support. A replay repeats the original's. |
error.available_units | integer0 or more | quota_exceeded: the results the account can still spend; a smaller limit may fit. |
error.period_ends_at | string | nulldate-time | quota_exceeded: when the included results reset with the billing period. |
error.manage_url | stringuri | quota_exceeded: where to buy more results. |
| Status | Code | What to do | Retry-After |
|---|---|---|---|
| 400 | invalid_request | Check the ASIN, marketplace, type and limit. | No |
| 400 | unsupported_marketplace | This marketplace is not available. Supported: US. | No |
| 400 | invalid_cursor | This cursor is invalid, expired or from another request. Start again without a cursor. | No |
| 400 | response_too_large | This page is too large to send. Request a smaller limit. | No |
| 401 | invalid_api_key | Send a valid API key as a Bearer token in the Authorization header. | No |
| 402 | api_subscription_required | An active API subscription is required. | No |
| 402 | quota_exceeded | The API allowance is exhausted. | No |
| 403 | account_disabled | This account cannot use the API. | No |
| 403 | insufficient_scope | This API key does not allow this request. | No |
| 405 | method_not_allowed | Use GET. | No |
| 409 | results_changed | The results changed since this cursor was issued. Start again without a cursor. | No |
| 409 | idempotency_conflict | This Idempotency-Key was used for a different request. Use a new key. | No |
| 409 | response_unavailable | The response stored for this Idempotency-Key can no longer be sent. Use a new key. | No |
| 409 | request_in_progress | A request with this Idempotency-Key is still running. Retry it after the stated delay. | Yes |
| 429 | rate_limited | Too many requests. Retry after the stated delay. | Yes |
| 429 | request_limit_reached | The daily request limit is reached. Retry after the stated delay. | Yes |
| 503 | catalog_unavailable | The catalog is temporarily unavailable. Retry with backoff and the same Idempotency-Key. | No |
| 503 | access_unavailable | API access could not be checked. Retry with backoff and the same Idempotency-Key. | No |
| 503 | usage_unavailable | Usage could not be recorded. Retry with backoff and the same Idempotency-Key. | No |
| 503 | api_disabled | The API is disabled for now. Nothing was charged. Retry later with the same Idempotency-Key. | Yes |
Example answers
A lookup, first page
{
"request_id": "req_example_lookup",
"query": {
"asin": "B000000001",
"marketplace": "US",
"type": "all"
},
"match_kind": "exact",
"data": [
{
"influencer": {
"id": "inf_us_1001",
"handle": "example-influencer",
"name": "Example Influencer",
"storefront_url": "https://www.amazon.com/shop/example-influencer?creatorsDisableRedirect=true",
"avatar_url": null,
"social_links": [
{
"platform": "instagram",
"url": "https://instagram.com/example.influencer",
"source": "amazon_storefront"
}
],
"profile_checked_at": "2026-09-11T10:00:00.000Z"
},
"matching_content_counts": {
"video": 4,
"photo": 1,
"list": 1
},
"evidence": [
{
"id": "amzn1.vse.video.11111111111111111111111111111111",
"type": "video",
"title": "Example video one",
"url": "https://www.amazon.com/vdp/11111111111111111111111111111111",
"thumbnail_url": "https://m.media-amazon.com/images/I/example-video-1.jpg",
"relationship_observed_at": "2026-09-11T10:00:00.000Z"
},
{
"id": "amzn1.shoppablemedia.v1.00000000-0000-4000-8000-000000000001",
"type": "photo",
"title": null,
"url": null,
"thumbnail_url": "https://m.media-amazon.com/images/I/example-photo-1.jpg",
"relationship_observed_at": "2026-09-11T10:00:00.000Z"
},
{
"id": "amzn1.ideas.EXAMPLELIST01",
"type": "list",
"title": "Example kitchen favourites",
"url": "https://www.amazon.com/shop/example-influencer/list/EXAMPLELIST01?creatorsDisableRedirect=true",
"thumbnail_url": null,
"relationship_observed_at": "2026-09-11T10:00:00.000Z"
},
{
"id": "amzn1.vse.video.22222222222222222222222222222222",
"type": "video",
"title": "Example video two",
"url": "https://www.amazon.com/vdp/22222222222222222222222222222222",
"thumbnail_url": "https://m.media-amazon.com/images/I/example-video-2.jpg",
"relationship_observed_at": "2026-09-10T10:00:00.000Z"
},
{
"id": "amzn1.vse.video.33333333333333333333333333333333",
"type": "video",
"title": "Example video three",
"url": "https://www.amazon.com/vdp/33333333333333333333333333333333",
"thumbnail_url": "https://m.media-amazon.com/images/I/example-video-3.jpg",
"relationship_observed_at": "2026-09-10T10:00:00.000Z"
}
],
"evidence_has_more": true,
"coverage": {
"video": {
"status": "complete",
"checked_at": "2026-09-11T10:00:00.000Z"
},
"photo": {
"status": "partial",
"checked_at": "2026-09-11T10:00:00.000Z"
},
"list": {
"status": "partial",
"checked_at": "2026-09-04T10:00:00.000Z"
}
}
},
{
"influencer": {
"id": "inf_us_1002",
"handle": "second-example",
"name": null,
"storefront_url": "https://www.amazon.com/shop/second-example?creatorsDisableRedirect=true",
"avatar_url": null,
"social_links": [],
"profile_checked_at": "2026-09-08T10:00:00.000Z"
},
"matching_content_counts": {
"video": 1,
"photo": 0,
"list": 0
},
"evidence": [
{
"id": "amzn1.vse.video.44444444444444444444444444444444",
"type": "video",
"title": "Example review",
"url": "https://www.amazon.com/vdp/44444444444444444444444444444444",
"thumbnail_url": "https://m.media-amazon.com/images/I/example-video-4.jpg",
"relationship_observed_at": "2026-09-08T10:00:00.000Z"
}
],
"evidence_has_more": false,
"coverage": {
"video": {
"status": "partial",
"checked_at": "2026-09-08T10:00:00.000Z"
},
"photo": {
"status": "unknown",
"checked_at": null
},
"list": {
"status": "unknown",
"checked_at": null
}
}
}
],
"pagination": {
"limit": 2,
"next_cursor": "c1.1002.0123456789abcdef0123456789abcdef.1792224000000.0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
},
"meta": {
"source": "indexed",
"result_status": "matches",
"generated_at": "2026-09-17T10:00:00.000Z"
},
"usage": {
"unit": "influencer_result",
"charged": 2,
"replayed": false
}
}Videos only (type=video)
{
"request_id": "req_example_video",
"query": {
"asin": "B000000001",
"marketplace": "US",
"type": "video"
},
"match_kind": "exact",
"data": [
{
"influencer": {
"id": "inf_us_1001",
"handle": "example-influencer",
"name": "Example Influencer",
"storefront_url": "https://www.amazon.com/shop/example-influencer?creatorsDisableRedirect=true",
"avatar_url": null,
"social_links": [
{
"platform": "instagram",
"url": "https://instagram.com/example.influencer",
"source": "amazon_storefront"
}
],
"profile_checked_at": "2026-09-11T10:00:00.000Z"
},
"matching_content_counts": {
"video": 4
},
"evidence": [
{
"id": "amzn1.vse.video.11111111111111111111111111111111",
"type": "video",
"title": "Example video one",
"url": "https://www.amazon.com/vdp/11111111111111111111111111111111",
"thumbnail_url": "https://m.media-amazon.com/images/I/example-video-1.jpg",
"relationship_observed_at": "2026-09-11T10:00:00.000Z"
},
{
"id": "amzn1.vse.video.22222222222222222222222222222222",
"type": "video",
"title": "Example video two",
"url": "https://www.amazon.com/vdp/22222222222222222222222222222222",
"thumbnail_url": "https://m.media-amazon.com/images/I/example-video-2.jpg",
"relationship_observed_at": "2026-09-10T10:00:00.000Z"
},
{
"id": "amzn1.vse.video.33333333333333333333333333333333",
"type": "video",
"title": "Example video three",
"url": "https://www.amazon.com/vdp/33333333333333333333333333333333",
"thumbnail_url": "https://m.media-amazon.com/images/I/example-video-3.jpg",
"relationship_observed_at": "2026-09-10T10:00:00.000Z"
},
{
"id": "amzn1.vse.video.55555555555555555555555555555555",
"type": "video",
"title": "Example video four",
"url": "https://www.amazon.com/vdp/55555555555555555555555555555555",
"thumbnail_url": "https://m.media-amazon.com/images/I/example-video-5.jpg",
"relationship_observed_at": "2026-09-09T10:00:00.000Z"
}
],
"evidence_has_more": false,
"coverage": {
"video": {
"status": "complete",
"checked_at": "2026-09-11T10:00:00.000Z"
}
}
},
{
"influencer": {
"id": "inf_us_1002",
"handle": "second-example",
"name": null,
"storefront_url": "https://www.amazon.com/shop/second-example?creatorsDisableRedirect=true",
"avatar_url": null,
"social_links": [],
"profile_checked_at": "2026-09-08T10:00:00.000Z"
},
"matching_content_counts": {
"video": 1
},
"evidence": [
{
"id": "amzn1.vse.video.44444444444444444444444444444444",
"type": "video",
"title": "Example review",
"url": "https://www.amazon.com/vdp/44444444444444444444444444444444",
"thumbnail_url": "https://m.media-amazon.com/images/I/example-video-4.jpg",
"relationship_observed_at": "2026-09-08T10:00:00.000Z"
}
],
"evidence_has_more": false,
"coverage": {
"video": {
"status": "partial",
"checked_at": "2026-09-08T10:00:00.000Z"
}
}
}
],
"pagination": {
"limit": 2,
"next_cursor": null
},
"meta": {
"source": "indexed",
"result_status": "matches",
"generated_at": "2026-09-17T10:00:00.000Z"
},
"usage": {
"unit": "influencer_result",
"charged": 2,
"replayed": false
}
}The next and last page (cursor)
{
"request_id": "req_example_next",
"query": {
"asin": "B000000001",
"marketplace": "US",
"type": "all"
},
"match_kind": "exact",
"data": [
{
"influencer": {
"id": "inf_us_1003",
"handle": "third-example",
"name": "Third Example",
"storefront_url": "https://www.amazon.com/shop/third-example?creatorsDisableRedirect=true",
"avatar_url": null,
"social_links": [],
"profile_checked_at": "2026-09-12T10:00:00.000Z"
},
"matching_content_counts": {
"video": 0,
"photo": 0,
"list": 1
},
"evidence": [
{
"id": "amzn1.ideas.EXAMPLELIST02",
"type": "list",
"title": "Example gift ideas",
"url": "https://www.amazon.com/shop/third-example/list/EXAMPLELIST02?creatorsDisableRedirect=true",
"thumbnail_url": null,
"relationship_observed_at": "2026-09-12T10:00:00.000Z"
}
],
"evidence_has_more": false,
"coverage": {
"video": {
"status": "complete",
"checked_at": "2026-09-12T10:00:00.000Z"
},
"photo": {
"status": "complete",
"checked_at": "2026-09-12T10:00:00.000Z"
},
"list": {
"status": "complete",
"checked_at": "2026-09-12T10:00:00.000Z"
}
}
}
],
"pagination": {
"limit": 2,
"next_cursor": null
},
"meta": {
"source": "indexed",
"result_status": "matches",
"generated_at": "2026-09-17T10:00:00.000Z"
},
"usage": {
"unit": "influencer_result",
"charged": 1,
"replayed": false
}
}No indexed matches: free
{
"request_id": "req_example_empty",
"query": {
"asin": "B000000009",
"marketplace": "US",
"type": "all"
},
"match_kind": "exact",
"data": [],
"pagination": {
"limit": 20,
"next_cursor": null
},
"meta": {
"source": "indexed",
"result_status": "no_indexed_matches",
"generated_at": "2026-09-17T10:00:00.000Z"
},
"usage": {
"unit": "influencer_result",
"charged": 0,
"replayed": false
}
}A retry with the same Idempotency-Key: the stored answer, free
{
"request_id": "req_example_lookup",
"query": {
"asin": "B000000001",
"marketplace": "US",
"type": "all"
},
"match_kind": "exact",
"data": [
{
"influencer": {
"id": "inf_us_1001",
"handle": "example-influencer",
"name": "Example Influencer",
"storefront_url": "https://www.amazon.com/shop/example-influencer?creatorsDisableRedirect=true",
"avatar_url": null,
"social_links": [
{
"platform": "instagram",
"url": "https://instagram.com/example.influencer",
"source": "amazon_storefront"
}
],
"profile_checked_at": "2026-09-11T10:00:00.000Z"
},
"matching_content_counts": {
"video": 4,
"photo": 1,
"list": 1
},
"evidence": [
{
"id": "amzn1.vse.video.11111111111111111111111111111111",
"type": "video",
"title": "Example video one",
"url": "https://www.amazon.com/vdp/11111111111111111111111111111111",
"thumbnail_url": "https://m.media-amazon.com/images/I/example-video-1.jpg",
"relationship_observed_at": "2026-09-11T10:00:00.000Z"
},
{
"id": "amzn1.shoppablemedia.v1.00000000-0000-4000-8000-000000000001",
"type": "photo",
"title": null,
"url": null,
"thumbnail_url": "https://m.media-amazon.com/images/I/example-photo-1.jpg",
"relationship_observed_at": "2026-09-11T10:00:00.000Z"
},
{
"id": "amzn1.ideas.EXAMPLELIST01",
"type": "list",
"title": "Example kitchen favourites",
"url": "https://www.amazon.com/shop/example-influencer/list/EXAMPLELIST01?creatorsDisableRedirect=true",
"thumbnail_url": null,
"relationship_observed_at": "2026-09-11T10:00:00.000Z"
},
{
"id": "amzn1.vse.video.22222222222222222222222222222222",
"type": "video",
"title": "Example video two",
"url": "https://www.amazon.com/vdp/22222222222222222222222222222222",
"thumbnail_url": "https://m.media-amazon.com/images/I/example-video-2.jpg",
"relationship_observed_at": "2026-09-10T10:00:00.000Z"
},
{
"id": "amzn1.vse.video.33333333333333333333333333333333",
"type": "video",
"title": "Example video three",
"url": "https://www.amazon.com/vdp/33333333333333333333333333333333",
"thumbnail_url": "https://m.media-amazon.com/images/I/example-video-3.jpg",
"relationship_observed_at": "2026-09-10T10:00:00.000Z"
}
],
"evidence_has_more": true,
"coverage": {
"video": {
"status": "complete",
"checked_at": "2026-09-11T10:00:00.000Z"
},
"photo": {
"status": "partial",
"checked_at": "2026-09-11T10:00:00.000Z"
},
"list": {
"status": "partial",
"checked_at": "2026-09-04T10:00:00.000Z"
}
}
},
{
"influencer": {
"id": "inf_us_1002",
"handle": "second-example",
"name": null,
"storefront_url": "https://www.amazon.com/shop/second-example?creatorsDisableRedirect=true",
"avatar_url": null,
"social_links": [],
"profile_checked_at": "2026-09-08T10:00:00.000Z"
},
"matching_content_counts": {
"video": 1,
"photo": 0,
"list": 0
},
"evidence": [
{
"id": "amzn1.vse.video.44444444444444444444444444444444",
"type": "video",
"title": "Example review",
"url": "https://www.amazon.com/vdp/44444444444444444444444444444444",
"thumbnail_url": "https://m.media-amazon.com/images/I/example-video-4.jpg",
"relationship_observed_at": "2026-09-08T10:00:00.000Z"
}
],
"evidence_has_more": false,
"coverage": {
"video": {
"status": "partial",
"checked_at": "2026-09-08T10:00:00.000Z"
},
"photo": {
"status": "unknown",
"checked_at": null
},
"list": {
"status": "unknown",
"checked_at": null
}
}
}
],
"pagination": {
"limit": 2,
"next_cursor": "c1.1002.0123456789abcdef0123456789abcdef.1792224000000.0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
},
"meta": {
"source": "indexed",
"result_status": "matches",
"generated_at": "2026-09-17T10:00:00.000Z"
},
"usage": {
"unit": "influencer_result",
"charged": 0,
"replayed": true
}
}402 quota_exceeded
{
"error": {
"code": "quota_exceeded",
"message": "The API allowance is exhausted.",
"request_id": "req_example_quota",
"available_units": 12,
"period_ends_at": "2026-10-01T10:00:00.000Z",
"manage_url": "https://spreesy.com/app/account/api"
}
}409 results_changed
{
"error": {
"code": "results_changed",
"message": "The results changed since this cursor was issued. Start again without a cursor.",
"request_id": "req_example_changed"
}
}Code samples
Each sample reads the key from SPREESY_API_KEY on your server and sends a new Idempotency-Key for each page.
curl "https://spreesy.com/api/v1/products/B000000001/influencers?marketplace=US&limit=20" \ -H "Authorization: Bearer $SPREESY_API_KEY" \ -H "Idempotency-Key: $(uuidgen)"
// lookup.mjs: Node 18 or later, or any server runtime with fetch. Keep the key on your server.
const url = new URL("https://spreesy.com/api/v1/products/B000000001/influencers");
url.searchParams.set("marketplace", "US");
url.searchParams.set("limit", "20");
let cursor = null;
do {
if (cursor) url.searchParams.set("cursor", cursor);
const body = await getPage(url, crypto.randomUUID()); // a new Idempotency-Key for each page
for (const { influencer, matching_content_counts } of body.data) {
console.log(influencer.handle, JSON.stringify(matching_content_counts));
}
cursor = body.pagination.next_cursor;
} while (cursor);
// A retry reuses its page's Idempotency-Key, so it is never charged twice.
async function getPage(url, idempotencyKey) {
for (let attempt = 1; ; attempt++) {
const response = await fetch(url, {
headers: { Authorization: `Bearer ${process.env.SPREESY_API_KEY}`, "Idempotency-Key": idempotencyKey },
});
const body = await response.json();
if (response.ok) return body;
const retry = response.status === 503 || body.error.code === "request_in_progress";
if (!retry || attempt === 3) throw new Error(`${body.error.code}: ${body.error.message}`);
await new Promise((resolve) => setTimeout(resolve, Number(response.headers.get("retry-after") ?? 2) * 1000));
}
}# lookup.py: Python 3.8 or later, standard library only. Keep the key on your server.
import json, os, time, uuid
from urllib.error import HTTPError
from urllib.parse import urlencode
from urllib.request import Request, urlopen
URL = "https://spreesy.com/api/v1/products/B000000001/influencers"
def get_page(params, idempotency_key):
# A retry reuses its page's Idempotency-Key, so it is never charged twice.
request = Request(f"{URL}?{urlencode(params)}", headers={
"Authorization": f"Bearer {os.environ['SPREESY_API_KEY']}",
"Idempotency-Key": idempotency_key,
})
for attempt in range(1, 4):
try:
with urlopen(request, timeout=30) as response:
return json.load(response)
except HTTPError as failure:
error = json.load(failure)["error"]
if attempt == 3 or (failure.code != 503 and error["code"] != "request_in_progress"):
raise RuntimeError(f"{error['code']}: {error['message']}") from None
time.sleep(int(failure.headers.get("Retry-After", "2")))
params = {"marketplace": "US", "limit": 20}
while True:
body = get_page(params, str(uuid.uuid4())) # a new Idempotency-Key for each page
for result in body["data"]:
print(result["influencer"]["handle"], json.dumps(result["matching_content_counts"]))
if not body["pagination"]["next_cursor"]:
break
params["cursor"] = body["pagination"]["next_cursor"]
The Tidy Home Favorites
Carolina McCauley
Naptime Kitchen
Reilly's Amazon Finds
Dani Atkinson
Lauren Burke
Em S