Skip to main content

Actor input

The Actor gets its input from the input record in its default key-value store.

To access it, instead of reading the record manually, you can use the Actor.get_input() convenience method. It will get the input record key from the Actor configuration, read the record from the default key-value store, and decrypt any secret input fields.

For example, if an Actor received a JSON input with two fields, { "firstNumber": 1, "secondNumber": 2 }, this is how you might process it:

src/main.py
from apify import Actor

async def main():
async with Actor:
actor_input = await Actor.get_input() or {}
first_number = actor_input.get('firstNumber')
second_number = actor_input.get('secondNumber')
Actor.log.info(f'Sum: {first_number + second_number}')