Skip to content

Commit a969033

Browse files
vdusekclaude
andauthored
docs: Document missing SDK features across concept pages (#852)
## Summary - Document 13 previously undocumented SDK features across 8 concept pages with 8 new runnable code examples - Replace all relative markdown API reference links with `<ApiLink>` component across all concept pages - Improve `ApifyRequestList` docstring in source code - Add closing notes with links to platform docs on relevant pages --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 916a62d commit a969033

21 files changed

+406
-71
lines changed

docs/02_concepts/01_actor_lifecycle.mdx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,15 @@ When the Actor exits, either normally or due to an exception, the SDK performs a
4343
</TabItem>
4444
</Tabs>
4545

46-
You can also create an [`Actor`](https://docs.apify.com/sdk/python/reference/class/Actor) instance directly. This does not change its capabilities but allows you to specify optional parameters during initialization, such as disabling automatic `sys.exit()` calls or customizing timeouts. The choice between using a context manager or manual initialization depends on how much control you require over the Actor's startup and shutdown sequence.
46+
You can also create an [`Actor`](https://docs.apify.com/sdk/python/reference/class/Actor) instance directly. This does not change its capabilities but allows you to specify optional parameters during initialization. The key parameters are:
47+
48+
- `configuration` — a custom [`Configuration`](https://docs.apify.com/sdk/python/reference/class/Configuration) instance to control storage paths, API URLs, and other settings.
49+
- `configure_logging` — whether to set up default logging configuration (default `True`). Set to `False` if you configure logging yourself.
50+
- `exit_process` — whether the Actor calls `sys.exit()` when the context manager exits. Defaults to `True`, except in IPython, Pytest, and Scrapy environments.
51+
- `event_listeners_timeout` — maximum time to wait for Actor event listeners to complete before exiting.
52+
- `cleanup_timeout` — maximum time to wait for cleanup tasks to finish (default 30 seconds).
53+
54+
The choice between using a context manager or manual initialization depends on how much control you require over the Actor's startup and shutdown sequence.
4755

4856
<Tabs groupId="request_queue">
4957
<TabItem value="actor_instance_with_context_manager" label="Actor instance with context manager" default>

docs/02_concepts/02_actor_input.mdx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,31 @@ description: Read and validate input data passed to your Actor at runtime.
77
import RunnableCodeBlock from '@site/src/components/RunnableCodeBlock';
88

99
import InputExample from '!!raw-loader!roa-loader!./code/02_input.py';
10+
import RequestListExample from '!!raw-loader!roa-loader!./code/02_request_list.py';
11+
import ApiLink from '@site/src/components/ApiLink';
1012

1113
The Actor gets its [input](https://docs.apify.com/platform/actors/running/input) from the input record in its default [key-value store](https://docs.apify.com/platform/storage/key-value-store).
1214

13-
To access it, instead of reading the record manually, you can use the [`Actor.get_input`](../../reference/class/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](https://docs.apify.com/platform/actors/development/secret-input).
15+
To access it, instead of reading the record manually, you can use the <ApiLink to="class/Actor#get_input">`Actor.get_input`</ApiLink> 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](https://docs.apify.com/platform/actors/development/secret-input).
1416

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

1719
<RunnableCodeBlock className="language-python" language="python">
1820
{InputExample}
1921
</RunnableCodeBlock>
22+
23+
## Loading URLs from Actor input
24+
25+
Actors commonly receive a list of URLs to process via their input. The <ApiLink to="class/ApifyRequestList">`ApifyRequestList`</ApiLink> 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.
26+
27+
<RunnableCodeBlock className="language-python" language="python">
28+
{RequestListExample}
29+
</RunnableCodeBlock>
30+
31+
## Secret input fields
32+
33+
The Apify platform supports [secret input fields](https://docs.apify.com/platform/actors/development/secret-input) that are encrypted before being stored. When you mark an input field as `"isSecret": true` in your Actor's [input schema](https://docs.apify.com/platform/actors/development/input-schema), the platform encrypts the value with the Actor's public key.
34+
35+
No special handling is needed in your code — when you call <ApiLink to="class/Actor#get_input">`Actor.get_input`</ApiLink>, 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.
36+
37+
For more details on Actor input and how to define input schemas, see the [Actor input](https://docs.apify.com/platform/actors/running/input) and [input schema](https://docs.apify.com/platform/actors/development/input-schema) documentation on the Apify platform.

0 commit comments

Comments
 (0)