Skip to content

Latest commit

 

History

History
41 lines (26 loc) · 2.97 KB

File metadata and controls

41 lines (26 loc) · 2.97 KB
id actor-input
title Actor input
description Read and validate input data passed to your Actor at runtime.

import RunnableCodeBlock from '@site/src/components/RunnableCodeBlock';

import InputExample from '!!raw-loader!roa-loader!./code/02_input.py'; import RequestListExample from '!!raw-loader!roa-loader!./code/02_request_list.py'; import ApiLink from '@theme/ApiLink';

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 gets the input record key from the Actor configuration, reads the record from the default key-value store, and decrypts 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:

{InputExample}

Loading URLs from Actor input

Actors commonly receive a list of URLs to process via their input. The ApifyRequestList class (from apify.request_loaders) can parse the standard Apify input format for URL sources. It supports both direct URL objects ({"url": "https://example.com"}) and remote URL lists ({"requestsFromUrl": "https://example.com/urls.txt"}), where the remote file contains one URL per line.

{RequestListExample}

Secret input fields

The Apify platform supports secret input fields that are encrypted before being stored. When you mark an input field as "isSecret": true in your Actor's input schema, the platform encrypts the value with the Actor's public key.

No special handling is needed in your code — when you call Actor.get_input, encrypted fields are automatically decrypted using the Actor's private key, which is provided by the platform via environment variables. You receive the plaintext values directly.

Conclusion

This page has shown how to read Actor input with Actor.get_input, how to load URL sources with ApifyRequestList, and how secret input fields are decrypted automatically when you read them.

For more details on Actor input and how to define input schemas, see the Actor input and input schema documentation on the Apify platform.