-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy path06_interacting_call.py
More file actions
32 lines (24 loc) · 900 Bytes
/
06_interacting_call.py
File metadata and controls
32 lines (24 loc) · 900 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import asyncio
from apify import Actor
async def main() -> None:
async with Actor:
# Start the apify/screenshot-url Actor.
actor_run = await Actor.call(
actor_id='apify/screenshot-url',
run_input={
'urls': [{'url': 'https://www.apify.com/'}],
'delay': 1000,
'waitUntil': 'load',
},
)
if actor_run is None:
raise RuntimeError('Actor task failed to start.')
# Wait for the Actor run to finish.
run_client = Actor.apify_client.run(actor_run.id)
await run_client.wait_for_finish()
# Get the Actor output from the dataset.
dataset_client = run_client.dataset()
item_list = await dataset_client.list_items()
Actor.log.info(f'Actor output: {item_list.items}')
if __name__ == '__main__':
asyncio.run(main())