1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "contractJson": """{
10 \"fields\": [
11 {\"name\": \"supplier\", \"type\": \"string\"},
12 {\"name\": \"sku\", \"type\": \"string\"},
13 {\"name\": \"units\", \"type\": \"integer\", \"constraints\": {\"required\": true}}
14 ],
15 \"primaryKey\": [\"supplier\", \"sku\"]
16}""",
17 "csvText": """supplier,sku,units
18north,0017,12
19north,17,4
20north,0017,1.5
21""",
22}
23
24
25run = client.actor("satisfied_laptop/csv-contract-preflight").call(run_input=run_input)
26
27
28print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
29for item in client.dataset(run.default_dataset_id).iterate_items():
30 print(item)
31
32