Skip to content

Latest commit

 

History

History
35 lines (23 loc) · 2.42 KB

File metadata and controls

35 lines (23 loc) · 2.42 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 '@site/src/components/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 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:

{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.