1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "items": [
10 {
11 "name": "Blue Door Cafe",
12 "website": "https://bluedoor.example",
13 "rating": 4.6,
14 "emails": ["hello@bluedoor.example"],
15 "address": { "city": "Oslo" },
16 },
17 {
18 "name": "Corner Bar",
19 "website": "",
20 "rating": 4.2,
21 "emails": [],
22 "address": { "city": "Bergen" },
23 },
24 {
25 "name": "Harbor Hotel",
26 "website": "https://harbor.example",
27 "rating": 3.8,
28 "emails": ["info@harbor.example"],
29 "address": { "city": "Bergen" },
30 },
31 {
32 "name": "Fjord Bakery",
33 "website": "https://fjordbakery.example",
34 "rating": "4.9",
35 "emails": ["post@fjordbakery.example"],
36 "address": { "city": "Oslo" },
37 },
38 ],
39 "filters": [
40 {
41 "field": "website",
42 "op": "isNotEmpty",
43 },
44 {
45 "field": "rating",
46 "op": "greaterOrEqual",
47 "value": 4,
48 },
49 ],
50}
51
52
53run = client.actor("charlesmarkette/dataset-filter-transform-rename-flatten-fields").call(run_input=run_input)
54
55
56print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
57for item in client.dataset(run.default_dataset_id).iterate_items():
58 print(item)
59
60