1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "reporterCodes": [
10 "842",
11 "156",
12 ],
13 "partnerCodes": ["0"],
14 "periods": [
15 "2023",
16 "2022",
17 ],
18 "commodityCodes": [
19 "TOTAL",
20 "01",
21 "02",
22 "03",
23 "04",
24 "05",
25 "06",
26 "07",
27 "08",
28 "09",
29 "10",
30 "11",
31 "12",
32 "13",
33 "14",
34 "15",
35 "16",
36 "17",
37 "18",
38 "19",
39 "20",
40 "21",
41 "22",
42 "23",
43 "24",
44 ],
45 "flowCodes": [
46 "M",
47 "X",
48 ],
49 "frequency": "A",
50 "classification": "HS",
51 "tradeType": "C",
52 "includeDescriptions": True,
53 "maxRows": 20,
54 "requestDelayMillis": 250,
55 "failOnApiError": False,
56}
57
58
59run = client.actor("automation-lab/un-comtrade-trade-data-scraper").call(run_input=run_input)
60
61
62print("๐พ Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
63for item in client.dataset(run["defaultDatasetId"]).iterate_items():
64 print(item)
65
66