You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: Standardize language, wording, and API links across all pages (#697)
## Summary
- Standardize opening paragraphs to follow "what it is + why it matters"
pattern
- Unify example intro phrasing to "The following example shows how
to..."
- Migrate all API reference links from raw markdown to `<ApiLink>`
component
- Trim verbose "benefits" paragraphs in pagination and streaming pages
- Add `:::tip` admonitions to convenience methods and pagination pages
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@@ -44,9 +46,9 @@ The API token is used to authorize your requests to the Apify API. You can be ch
44
46
45
47
## Step 2: Run an Actor
46
48
47
-
To start an Actor, call the [`apify_client.actor()`](/reference/class/ActorClient) method with the Actor's ID (e.g., `john-doe/my-cool-actor`). The Actor's ID is a combination of the Actor owner's username and the Actor name. You can run both your own Actors and Actors from [Apify Store](https://apify.com/store).
49
+
To start an Actor, call the <ApiLinkto="class/ActorClient">`apify_client.actor()`</ApiLink> method with the Actor's ID (e.g., `john-doe/my-cool-actor`). The Actor's ID is a combination of the Actor owner's username and the Actor name. You can run both your own Actors and Actors from [Apify Store](https://apify.com/store).
48
50
49
-
To define the Actor's input, pass a dictionary to the [`call()`](/reference/class/ActorClient#call) method that matches the Actor's [input schema](https://docs.apify.com/platform/actors/development/actor-definition/input-schema). The input can include URLs to scrape, search terms, or other configuration data.
51
+
To define the Actor's input, pass a dictionary to the <ApiLinkto="class/ActorClient#call">`call()`</ApiLink> method that matches the Actor's [input schema](https://docs.apify.com/platform/actors/development/actor-definition/input-schema). The input can include URLs to scrape, search terms, or other configuration data.
@@ -63,7 +65,7 @@ To define the Actor's input, pass a dictionary to the [`call()`](/reference/clas
63
65
64
66
## Step 3: Get results from the dataset
65
67
66
-
To get the results from the dataset, call the [`apify_client.dataset()`](/reference/class/DatasetClient) method with the dataset ID, then call [`list_items()`](/reference/class/DatasetClient#list_items) to retrieve the data. You can get the dataset ID from the Actor's run dictionary (represented by `defaultDatasetId`).
68
+
To get the results from the dataset, call the <ApiLinkto="class/DatasetClient">`apify_client.dataset()`</ApiLink> method with the dataset ID, then call <ApiLinkto="class/DatasetClient#list_items">`list_items()`</ApiLink> to retrieve the data. You can get the dataset ID from the Actor's run dictionary (represented by `defaultDatasetId`).
The package provides an asynchronous version of the client, [`ApifyClientAsync`](/reference/class/ApifyClientAsync), which allows you to interact with the Apify API using Python's standard async/await syntax. This enables you to perform non-blocking operations, see the Python [asyncio documentation](https://docs.python.org/3/library/asyncio-task.html) for more information.
15
+
The package provides an asynchronous version of the client, <ApiLinkto="class/ApifyClientAsync">`ApifyClientAsync`</ApiLink>, which allows you to interact with the Apify API using Python's standard async/await syntax. This enables you to perform non-blocking operations, see the Python [asyncio documentation](https://docs.python.org/3/library/asyncio-task.html) for more information. This is useful for applications that need to perform multiple API operations concurrently or integrate with other async frameworks.
14
16
15
-
The following example demonstrates how to run an Actor asynchronously and stream its logs while it is running:
17
+
The following example shows how to run an Actor asynchronously and stream its logs while it is running:
The Apify client interface is designed to be consistent and intuitive across all of its components. When you call specific methods on the main client, you create specialized clients to manage individual API resources. There are two main types of clients:
18
+
The Apify client provides two types of resource clients: single-resource clients for managing an individual resource, and collection clients for listing or creating resources.
17
19
18
-
-[`ActorClient`](/reference/class/ActorClient) - Manages a single resource.
19
-
-[`ActorCollectionClient`](/reference/class/ActorCollectionClient) - Manages a collection of resources.
20
+
-<ApiLinkto="class/ActorClient">`ActorClient`</ApiLink> - Manages a single resource.
21
+
-<ApiLinkto="class/ActorCollectionClient">`ActorCollectionClient`</ApiLink> - Manages a collection of resources.
In some cases, the Apify client provides nested clients to simplify working with related collections. For example, you can easily manage the runs of a specific Actor without having to construct multiple endpoints or client instances manually.
16
+
Nested clients let you access related resources directly from a parent resource client, without manually constructing new client instances.
@@ -26,4 +28,4 @@ In some cases, the Apify client provides nested clients to simplify working with
26
28
</TabItem>
27
29
</Tabs>
28
30
29
-
This direct access to [Dataset](https://docs.apify.com/platform/storage/dataset) (and other storage resources) from the [`RunClient`](/reference/class/RunClient) is especially convenient when used alongside the [`ActorClient.last_run`](/reference/class/ActorClient#last_run) method.
31
+
This direct access to [Dataset](https://docs.apify.com/platform/storage/dataset) (and other storage resources) from the <ApiLinkto="class/RunClient">`RunClient`</ApiLink> is especially convenient when used alongside the <ApiLinkto="class/ActorClient#last_run">`ActorClient.last_run`</ApiLink> method.
When you use the Apify client, it automatically extracts all relevant data from the endpoint and returns it in the expected format. Date strings, for instance, are seamlessly converted to Python `datetime.datetime` objects. If an error occurs, the client raises an [`ApifyApiError`](/reference/class/ApifyApiError). This exception wraps the raw JSON errors returned by the API and provides additional context, making it easier to debug any issues that arise.
16
+
When you use the Apify client, it automatically extracts all relevant data from the endpoint and returns it in the expected format. Date strings, for instance, are seamlessly converted to Python `datetime.datetime` objects. If an error occurs, the client raises an <ApiLinkto="class/ApifyApiError">`ApifyApiError`</ApiLink>. This exception wraps the raw JSON errors returned by the API and provides additional context, making it easier to debug any issues that arise.
The Apify client provides several convenience methods to handle actions that the API alone cannot perform efficiently, such as waiting for an Actor run to finish without running into network timeouts. These methods simplify common tasks and enhance the usability of the client.
15
17
16
-
-[`ActorClient.call`](/reference/class/ActorClient#call) - Starts an Actor and waits for it to finish, handling network timeouts internally. Waits indefinitely by default, or up to the specified `wait_duration`.
17
-
-[`ActorClient.start`](/reference/class/ActorClient#start) - Starts an Actor and immediately returns the Run object without waiting for it to finish.
18
-
-[`RunClient.wait_for_finish`](/reference/class/RunClient#wait_for_finish) - Waits for an already-started run to reach a terminal status.
18
+
-<ApiLinkto="class/ActorClient#call">`ActorClient.call`</ApiLink> - Starts an Actor and waits for it to finish, handling network timeouts internally. Waits indefinitely by default, or up to the specified `wait_duration`.
19
+
-<ApiLinkto="class/ActorClient#start">`ActorClient.start`</ApiLink> - Starts an Actor and immediately returns the Run object without waiting for it to finish.
20
+
-<ApiLinkto="class/RunClient#wait_for_finish">`RunClient.wait_for_finish`</ApiLink> - Waits for an already-started run to reach a terminal status.
19
21
20
22
Additionally, storage-related resources offer flexible options for data retrieval:
21
23
@@ -34,3 +36,7 @@ Additionally, storage-related resources offer flexible options for data retrieva
34
36
</CodeBlock>
35
37
</TabItem>
36
38
</Tabs>
39
+
40
+
:::tip
41
+
The `call()` method polls internally and may take a long time for long-running Actors. Use `start()` and `wait_for_finish()` separately if you need more control over the waiting behavior.
Most methods named `list` or `list_something` in the Apify client return a [`ListPage`](/reference/class/ListPage) object. This object provides a consistent interface for working with paginated data and includes the following properties:
16
+
Most methods named `list` or `list_something` in the Apify client return a <ApiLinkto="class/ListPage">`ListPage`</ApiLink> object. This object provides a consistent interface for working with paginated data and includes the following properties:
15
17
16
18
-`items` - The main results you're looking for.
17
19
-`total` - The total number of items available.
@@ -21,7 +23,7 @@ Most methods named `list` or `list_something` in the Apify client return a [`Lis
21
23
22
24
Some methods, such as `list_keys` or `list_head`, paginate differently. Regardless, the primary results are always stored under the items property, and the limit property can be used to control the number of results returned.
23
25
24
-
The following example demonstrates how to fetch all items from a dataset using pagination:
26
+
The following example shows how to fetch all items from a dataset using pagination:
@@ -36,4 +38,8 @@ The following example demonstrates how to fetch all items from a dataset using p
36
38
</TabItem>
37
39
</Tabs>
38
40
39
-
The [`ListPage`](/reference/class/ListPage) interface offers several key benefits. Its consistent structure ensures predictable results for most `list` methods, providing a uniform way to work with paginated data. It also offers flexibility, allowing you to customize the `limit` and `offset` parameters to control data fetching according to your needs. Additionally, it provides scalability, enabling you to efficiently handle large datasets through pagination. This approach ensures efficient data retrieval while keeping memory usage under control, making it ideal for managing and processing large collections.
41
+
This approach lets you efficiently retrieve large datasets through pagination while keeping memory usage under control.
42
+
43
+
:::tip
44
+
For most use cases, prefer `iterate_items()` which handles pagination automatically and yields items one by one.
Certain resources, such as dataset items, key-value store records, and logs, support streaming directly from the Apify API. This allows you to process large resources incrementally without downloading them entirely into memory, making it ideal for handling large or continuously updated data.
-<ApiLinkto="class/KeyValueStoreClient#stream_record">`KeyValueStoreClient.stream_record`</ApiLink> - Stream key-value store records as raw data.
22
+
-<ApiLinkto="class/LogClient#stream">`LogClient.stream`</ApiLink> - Stream logs in real time.
21
23
22
24
These methods return a raw, context-managed `impit.Response` object. The response must be consumed within a with block to ensure that the connection is closed automatically, preventing memory leaks or unclosed connections.
23
25
24
-
The following example demonstrates how to stream the logs of an Actor run incrementally:
26
+
The following example shows how to stream the logs of an Actor run incrementally:
@@ -36,4 +38,4 @@ The following example demonstrates how to stream the logs of an Actor run increm
36
38
</TabItem>
37
39
</Tabs>
38
40
39
-
Streaming offers several key benefits. It ensures memory efficiency by loading only a small portion of the resource into memory at any given time, making it ideal for handling large data. It enables real-time processing, allowing you to start working with data immediately as it is received. With automatic resource management, using the `with` statement ensures that connections are properly closed, preventing memory leaks or unclosed connections. This approach is valuable for processing large logs, datasets, or files on the fly without the need to download them entirely.
41
+
Streaming is ideal for processinglarge logs, datasets, or files incrementally without downloading them entirely into memory.
0 commit comments