import jsonimport osimport requestspayload = json.loads(r'''{ "capability": "talabatmart.collections.list", "input": { "area_id": 8900, "country": "kw", "lat": 29.34141379, "lng": 48.019974472, "page": 0, "vendor_id": "688550" }}''')response = requests.post( "https://data.upscrape.com/execute", headers={ "Authorization": f"Bearer {os.environ['UPSCRAPE_API_KEY']}", "Content-Type": "application/json", "Prefer": "wait=30", }, json=payload,)response.raise_for_status()print(json.dumps(response.json(), indent=2))
const response = await fetch("https://data.upscrape.com/execute", { method: "POST", headers: { "Authorization": `Bearer ${process.env.UPSCRAPE_API_KEY}`, "Content-Type": "application/json", "Prefer": "wait=30", }, body: JSON.stringify({ "capability": "talabatmart.collections.list", "input": { "area_id": 8900, "country": "kw", "lat": 29.34141379, "lng": 48.019974472, "page": 0, "vendor_id": "688550" }}),});if (!response.ok) { throw new Error(`Upscrape request failed: ${response.status}`);}console.log(JSON.stringify(await response.json(), null, 2));
Response
{ "categories": [ { "category": { "title": "Top savers", "id": "6dc0f592-551e-4703-ba49-b4a792676620.ef0421c5-124a-415d-afbf-bfc40ae567f1.d6d8bea0-3960-4799-8cf7-e0dc06373dcc" }, "products": [ { "name": "Murouj White Toast Deliciously Soft with a Touch of Sweetness, 600g", "price": 0.475, "currency": "KWD", "id": "0068d9b6-b0e4-42c8-b954-b99b9cd921d5", "is_sponsored": false, "offer_text": "Save 30%", "original_price": 0.68, "sku": "925401", "stock_amount": 4, "characteristics": { "masterCode": "647c5bb690c94c660219d3cc" }, "pricing_details": { "price": 0.475, "highlight_style": "strikethrough", "original_price": 0.68 }, "tracking": { "nmr_ad_id": "", "query_id": "" }, "display_tags": [ { "text": "Save 30%", "campaign_id": "9adc692c-6a81-4df3-8f59-9e0d6a915921", "campaign_type": "Strikethrough", "style": "default", "type": "campaign" } ] }, { "name": "Eat Right ST Sebastien Cake, 120g", "price": 1.235, "currency": "KWD", "id": "006ea34a-7b5b-4278-91ff-dbe34922ada3", "is_sponsored": false, "offer_text": "Save 10%", "original_price": 1.375, "sku": "953006", "stock_amount": 1, "characteristics": { "masterCode": "6a9d2d807920451492cbb96a" }, "pricing_details": { "price": 1.235, "highlight_style": "strikethrough", "original_price": 1.375 }, "tracking": { "nmr_ad_id": "", "query_id": "" }, "display_tags": [ { "text": "Save 10%", "campaign_id": "d15134cd-f032-4945-ae08-accab62ac8e8", "campaign_type": "Strikethrough", "style": "default", "type": "campaign" } ] } ] }, { "category": { "title": "Fresh every day π", "id": "6dc0f592-551e-4703-ba49-b4a792676620.b4b6addd-1703-4b5c-b585-2c95bca6663e.d6d8bea0-3960-4799-8cf7-e0dc06373dcc" }, "products": [ { "name": "Formulas Watermelon Fruit Cuts, 200g", "price": 2.02, "currency": "KWD", "id": "0a597ba0-7f8d-49a2-830f-042c309ce477", "is_sponsored": false, "original_price": 2.02, "sku": "918116", "stock_amount": 2, "characteristics": { "masterCode": "6298a42d70a075ea352338af" }, "pricing_details": { "price": 2.02, "highlight_style": "default", "original_price": 2.02, "teaser": { "price": 1.615, "type": "tpro" } }, "tracking": { "nmr_ad_id": "", "query_id": "" }, "display_tags": [] }, { "name": "Formulas Mixed Fruits Cuts, 200g", "price": 2.475, "currency": "KWD", "id": "0b45e957-900e-47c7-9ada-1d10a97bcccf", "is_sponsored": false, "original_price": 2.475, "sku": "918119", "stock_amount": 3, "characteristics": { "masterCode": "6298a42e70a075ea35233981" }, "pricing_details": { "price": 2.475, "highlight_style": "default", "original_price": 2.475, "teaser": { "price": 1.98, "type": "tpro" } }, "tracking": { "nmr_ad_id": "", "query_id": "" }, "display_tags": [] } ] } ]}