1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "items": [
10 {
11 "id": 1,
12 "name": "Anna Smith",
13 "email": "anna@acme.com",
14 "company": "Acme Inc",
15 "phone": "",
16 "city": "Austin",
17 },
18 {
19 "id": 2,
20 "name": "Ben Jones",
21 "email": "ben@globex.com",
22 "company": "Globex",
23 "phone": "+1 555 010 2000",
24 "city": "Boston",
25 },
26 {
27 "id": 3,
28 "name": "Carla Diaz",
29 "email": "carla@initech.com",
30 "company": "Initech",
31 "phone": "",
32 "city": "Denver",
33 },
34 {
35 "id": 4,
36 "name": " ANNA SMITH ",
37 "email": "Anna@Acme.com",
38 "company": "Acme Inc",
39 "phone": "+1 555 010 1000",
40 "city": "",
41 },
42 {
43 "id": 5,
44 "name": "Ben Jones",
45 "email": "ben@globex.com",
46 "company": "Globex",
47 "phone": "+1 555 010 2000",
48 "city": "Boston",
49 },
50 {
51 "id": 6,
52 "name": "Carla Diaz",
53 "email": "CARLA@initech.com ",
54 "company": "Initech",
55 "phone": "",
56 "city": "Denver",
57 },
58 {
59 "id": 7,
60 "name": "Ana Smith",
61 "email": "ana@acme.com",
62 "company": "Acme Inc",
63 "phone": "",
64 "city": "Austin",
65 },
66 {
67 "id": 8,
68 "name": "Ben Jonse",
69 "email": "ben@globex.com",
70 "company": "Globex",
71 "phone": "",
72 "city": "Boston",
73 },
74 ],
75 "keyFields": [
76 "name",
77 "email",
78 ],
79 "matchMode": "fuzzy",
80 "fuzzyThreshold": 90,
81 "fieldTypes": { "email": "email" },
82 "keepStrategy": "first",
83 "mergeDuplicates": True,
84 "addDuplicateCount": True,
85 "addClusterId": True,
86 "exports": ["csv"],
87}
88
89
90run = client.actor("data-done-right/remove-duplicates").call(run_input=run_input)
91
92
93print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
94for item in client.dataset(run.default_dataset_id).iterate_items():
95 print(item)
96
97