1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "beforeSnapshot": { "products": [
10 {
11 "id": 1001,
12 "handle": "canvas-tote",
13 "title": "Canvas Tote",
14 "variants": [
15 {
16 "id": 2001,
17 "title": "Natural",
18 "sku": "TOTE-NAT",
19 "available": True,
20 "price": "24.00",
21 },
22 {
23 "id": 2002,
24 "title": "Black",
25 "sku": "TOTE-BLK",
26 "available": True,
27 "price": "24.00",
28 },
29 ],
30 },
31 {
32 "id": 1002,
33 "handle": "ceramic-mug",
34 "title": "Ceramic Mug",
35 "variants": [
36 {
37 "id": 2003,
38 "title": "White",
39 "sku": "MUG-WHT",
40 "available": False,
41 "price": "14.00",
42 },
43 {
44 "id": 2004,
45 "title": "Blue",
46 "sku": "MUG-BLU",
47 "available": True,
48 "price": "14.00",
49 },
50 ],
51 },
52 {
53 "id": 1003,
54 "handle": "notebook",
55 "title": "Notebook",
56 "variants": [{
57 "id": 2005,
58 "title": "A5",
59 "sku": "NB-A5",
60 "available": True,
61 "price": "9.00",
62 }],
63 },
64 ] },
65 "afterSnapshot": { "products": [
66 {
67 "id": 1001,
68 "handle": "canvas-tote",
69 "title": "Canvas Tote",
70 "variants": [
71 {
72 "id": 2001,
73 "title": "Natural",
74 "sku": "TOTE-NAT",
75 "available": False,
76 "price": "24.00",
77 },
78 {
79 "id": 2002,
80 "title": "Black",
81 "sku": "TOTE-BLK",
82 "available": True,
83 "price": "24.00",
84 },
85 ],
86 },
87 {
88 "id": 1002,
89 "handle": "ceramic-mug",
90 "title": "Ceramic Mug",
91 "variants": [
92 {
93 "id": 2003,
94 "title": "White",
95 "sku": "MUG-WHT",
96 "available": True,
97 "price": "15.00",
98 },
99 {
100 "id": 2004,
101 "title": "Blue",
102 "sku": "MUG-BLU",
103 "available": False,
104 "price": "14.00",
105 },
106 ],
107 },
108 {
109 "id": 1003,
110 "handle": "notebook",
111 "title": "Notebook",
112 "variants": [
113 {
114 "id": 2005,
115 "title": "A5",
116 "sku": "NB-A5",
117 "available": False,
118 "price": "9.00",
119 },
120 {
121 "id": 2006,
122 "title": "A6",
123 "sku": "NB-A6",
124 "available": False,
125 "price": "7.00",
126 },
127 ],
128 },
129 ] },
130}
131
132
133run = client.actor("practical_ai_lab_jp/pal-shopify-variant-availability-trends").call(run_input=run_input)
134
135
136print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
137for item in client.dataset(run.default_dataset_id).iterate_items():
138 print(item)
139
140