1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "redirectMap": """[
10 {
11 \"label\": \"W3C homepage HTTP to HTTPS\",
12 \"source\": \"http://www.w3.org/\",
13 \"destination\": \"https://www.w3.org/\",
14 \"status\": 200,
15 \"maxHops\": 3,
16 \"titleContains\": \"W3C\",
17 \"noindex\": false,
18 \"forbidSoft404\": true
19 },
20 {
21 \"label\": \"IANA example-domains guide\",
22 \"source\": \"https://www.iana.org/help/example-domains\",
23 \"destination\": \"https://www.iana.org/help/example-domains\",
24 \"status\": 200,
25 \"maxHops\": 2,
26 \"titleContains\": \"Example Domains\",
27 \"h1Contains\": \"Example Domains\",
28 \"noindex\": false,
29 \"forbidSoft404\": true
30 },
31 {
32 \"label\": \"Missing purchase CTA\",
33 \"source\": \"https://www.iana.org/help/example-domains\",
34 \"destination\": \"https://www.iana.org/help/example-domains\",
35 \"status\": 200,
36 \"titleContains\": \"Example Domains\",
37 \"requiredText\": \"Add to cart\"
38 },
39 {
40 \"label\": \"Old path collapsed to homepage\",
41 \"source\": \"https://httpbin.org/redirect-to?url=https://www.w3.org/&status_code=301\",
42 \"destination\": \"https://www.w3.org/TR/webarch/\",
43 \"status\": 200,
44 \"maxHops\": 5
45 },
46 {
47 \"label\": \"Redirect chain over hop budget\",
48 \"source\": \"https://httpbin.org/redirect/2\",
49 \"destination\": \"https://httpbin.org/get\",
50 \"status\": 200,
51 \"maxHops\": 1
52 },
53 {
54 \"label\": \"German market expected\",
55 \"source\": \"https://www.iana.org/help/example-domains\",
56 \"status\": 200,
57 \"region\": \"de\",
58 \"hreflang\": \"de-DE\"
59 }
60]""",
61 "patternAssertions": [{
62 "pattern": "https://www.iana.org/help/*",
63 "forbidSoft404": True,
64 "noindex": False,
65 }],
66 "monitorId": "sample",
67}
68
69
70run = client.actor("plusonets/site-migration-regression-auditor").call(run_input=run_input)
71
72
73print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
74for item in client.dataset(run.default_dataset_id).iterate_items():
75 print(item)
76
77