1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "records": [
10 {
11 "recordId": "valid-all-field",
12 "url": "https://ready.example/contact",
13 "email": "person@ready.example",
14 "address": "900 cedar street chicago il 60601",
15 },
16 {
17 "recordId": "partial-normalized",
18 "url": " partial.example/about/?utm_source=newsletter#team ",
19 "email": "person@partial.example",
20 },
21 {
22 "recordId": "no-actionable",
23 "url": " ",
24 "email": None,
25 "address": "",
26 },
27 {
28 "recordId": "invalid-only",
29 "url": "ftp://invalid.example",
30 "email": "missing-at-sign",
31 "address": "###",
32 },
33 {
34 "recordId": "mixed-valid-invalid",
35 "url": "https://mixed.example/contact",
36 "email": "missing-at-sign",
37 },
38 {
39 "recordId": "duplicate-url-a",
40 "url": "https://duplicate.example/contact",
41 "email": "alpha@duplicate.example",
42 },
43 {
44 "recordId": "duplicate-url-b",
45 "url": "https://duplicate.example/contact",
46 "email": "beta@duplicate.example",
47 },
48 {
49 "recordId": "domain-mismatch",
50 "url": "https://mismatch.example/contact",
51 "email": "owner@other.example",
52 },
53 {
54 "recordId": "email-review",
55 "email": "support@mailinator.com",
56 },
57 {
58 "recordId": "same-address-a",
59 "url": "https://north.example",
60 "email": "owner@north.example",
61 "address": "123 Main Street Suite 100, Austin, Texas 78701",
62 },
63 {
64 "recordId": "same-address-b",
65 "url": "https://south.example",
66 "email": "owner@south.example",
67 "address": "123 Main Street Suite 200, Austin, Texas 78701",
68 },
69 {
70 "recordId": "address-warning",
71 "address": "warehouse behind blue door",
72 },
73 ],
74 "workflow": {
75 "exportMode": "side_by_side",
76 "exportFormat": "csv",
77 "generatedFieldNamespace": "contactCleanup",
78 },
79 "fieldGroups": [
80 "url",
81 "email",
82 "address",
83 ],
84 "reviewStrictness": "standard",
85 "dedupeKeyMode": "keys_and_candidates",
86}
87
88
89run = client.actor("critd/contact-cleanup").call(run_input=run_input)
90
91
92print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
93for item in client.dataset(run.default_dataset_id).iterate_items():
94 print(item)
95
96