1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "mode": "analyze",
10 "sample": "english-services-agreement",
11 "schema": {
12 "type": "object",
13 "properties": {
14 "effective_date": {
15 "type": "string",
16 "format": "date",
17 "description": "the date the agreement takes effect",
18 },
19 "annual_fee": {
20 "type": "number",
21 "description": "the fixed annual fee payable by the client",
22 },
23 "notice_period_days": {
24 "type": "integer",
25 "description": "days of written notice required for non renewal",
26 "x-keywords": ["notice of non-renewal"],
27 },
28 "governing_law": {
29 "type": "string",
30 "description": "the law governing the agreement",
31 "x-keywords": ["governed by"],
32 },
33 },
34 "required": ["effective_date"],
35 },
36 "ocr": True,
37 "ocrLanguages": [
38 "eng",
39 "ara",
40 ],
41}
42
43
44run = client.actor("omargnagy/document-to-json-extractor").call(run_input=run_input)
45
46
47print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
48for item in client.dataset(run.default_dataset_id).iterate_items():
49 print(item)
50
51