1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "batches": [{
10 "id": "store-qa-orders",
11 "format": "csv",
12 "content": """order_id,amount,currency
13A-1001,42.50,EUR
14A-1002,18.00,EUR""",
15 }],
16 "contract": {
17 "version": "orders-v1",
18 "allowAdditionalFields": False,
19 "fields": [
20 {
21 "name": "order_id",
22 "type": "string",
23 "required": True,
24 "unique": True,
25 },
26 {
27 "name": "amount",
28 "type": "number",
29 "required": True,
30 "min": 0,
31 },
32 {
33 "name": "currency",
34 "type": "string",
35 "required": True,
36 "allowedValues": [
37 "EUR",
38 "USD",
39 ],
40 },
41 ],
42 },
43}
44
45
46run = client.actor("ceddl/csv-jsonl-data-contract-gate").call(run_input=run_input)
47
48
49print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
50for item in client.dataset(run.default_dataset_id).iterate_items():
51 print(item)
52
53