Skip to content

Commit e0a0bc8

Browse files
docs: Version docs for v2.5.1 [skip ci]
1 parent 5f7f7b1 commit e0a0bc8

52 files changed

Lines changed: 163233 additions & 29553 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎website/versioned_docs/version-2.5/01_introduction/code/03_input_async.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ async def main() -> None:
1212
'some': 'input',
1313
}
1414

15-
# Start an Actor and waits for it to finish.
15+
# Start an Actor and wait for it to finish.
1616
call_result = await actor_client.call(run_input=run_input)

‎website/versioned_docs/version-2.5/01_introduction/code/03_input_sync.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ def main() -> None:
1212
'some': 'input',
1313
}
1414

15-
# Start an Actor and waits for it to finish.
15+
# Start an Actor and wait for it to finish.
1616
call_result = actor_client.call(run_input=run_input)

‎website/versioned_docs/version-2.5/01_introduction/index.mdx‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
---
22
id: introduction
33
title: Overview
4-
sidebar_label: Overview
54
slug: /
6-
description: "The official Python library to access the Apify API, with automatic retries, async support, and comprehensive API coverage."
5+
description: The official Python library to access the Apify API, with automatic retries, async support, and comprehensive API coverage.
76
---
87

98
import Tabs from '@theme/Tabs';
@@ -24,7 +23,7 @@ The client simplifies interaction with the Apify platform by providing:
2423

2524
## Prerequisites
2625

27-
`apify-client` requires Python 3.10 or higher. Python is available for download on the [official website](https://www.python.org/downloads/). Check your current Python version by running:
26+
`apify-client` requires Python 3.11 or higher. Python is available for download on the [official website](https://www.python.org/downloads/). Check your current Python version by running:
2827

2928
```bash
3029
python --version
@@ -40,7 +39,7 @@ pip install apify-client
4039

4140
## Quick example
4241

43-
Here's an example showing how to run an Actor and retrieve its results:
42+
The following example shows how to run an Actor and retrieve its results:
4443

4544
<Tabs>
4645
<TabItem value="AsyncExample" label="Async client" default>

‎website/versioned_docs/version-2.5/01_introduction/quick-start.mdx‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
---
22
id: quick-start
33
title: Quick start
4-
sidebar_label: Quick start
5-
description: "Get started with the Apify API client for Python by running an Actor and retrieving results from its dataset."
4+
description: Get started with the Apify API client for Python by running an Actor and retrieving results from its dataset.
65
---
76

87
import Tabs from '@theme/Tabs';
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
id: asyncio-support
33
title: Asyncio support
4+
description: Use the async client for non-blocking API calls with Python asyncio.
45
---
56

67
import Tabs from '@theme/Tabs';
@@ -10,10 +11,12 @@ import ApiLink from '@theme/ApiLink';
1011

1112
import AsyncSupportExample from '!!raw-loader!./code/01_async_support.py';
1213

13-
The package provides an asynchronous version of the client, <ApiLink to="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.
14+
The package provides an asynchronous version of the client, <ApiLink to="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.
1415

15-
The following example demonstrates how to run an Actor asynchronously and stream its logs while it is running:
16+
The following example shows how to run an Actor asynchronously and stream its logs while it is running:
1617

1718
<CodeBlock className="language-python">
1819
{AsyncSupportExample}
1920
</CodeBlock>
21+
22+
For the full async client API, see the <ApiLink to="class/ApifyClientAsync">`ApifyClientAsync`</ApiLink> reference.

‎website/versioned_docs/version-2.5/02_concepts/02_single_collection_clients.mdx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
id: single-and-collection-clients
33
title: Single and collection clients
4+
description: Understand the two types of resource clients, single-resource and collection clients.
45
---
56

67
import Tabs from '@theme/Tabs';
@@ -14,7 +15,7 @@ import CollectionSyncExample from '!!raw-loader!./code/02_collection_sync.py';
1415
import SingleAsyncExample from '!!raw-loader!./code/02_single_async.py';
1516
import SingleSyncExample from '!!raw-loader!./code/02_single_sync.py';
1617

17-
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.
1819

1920
- <ApiLink to="class/ActorClient">`ActorClient`</ApiLink> - Manages a single resource.
2021
- <ApiLink to="class/ActorCollectionClient">`ActorCollectionClient`</ApiLink> - Manages a collection of resources.

‎website/versioned_docs/version-2.5/02_concepts/03_nested_clients.mdx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
id: nested-clients
33
title: Nested clients
4+
description: Access related resources directly through nested client methods.
45
---
56

67
import Tabs from '@theme/Tabs';
@@ -12,7 +13,7 @@ import ApiLink from '@theme/ApiLink';
1213
import NestedAsyncExample from '!!raw-loader!./code/03_nested_async.py';
1314
import NestedSyncExample from '!!raw-loader!./code/03_nested_sync.py';
1415

15-
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.
1617

1718
<Tabs>
1819
<TabItem value="AsyncExample" label="Async client" default>

‎website/versioned_docs/version-2.5/02_concepts/04_error_handling.mdx‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
id: error-handling
33
title: Error handling
4+
description: Handle API errors with the ApifyApiError exception and automatic data parsing.
45
---
56

67
import Tabs from '@theme/Tabs';
@@ -13,6 +14,22 @@ import ErrorSyncExample from '!!raw-loader!./code/04_error_sync.py';
1314

1415
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 <ApiLink to="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.
1516

17+
## Error subclasses
18+
19+
The Apify client provides dedicated error subclasses based on the HTTP status code of the failed response, so you can branch on error kind without inspecting `status_code` or `type`:
20+
21+
| Status | Subclass |
22+
|---|---|
23+
| 400 | <ApiLink to="class/InvalidRequestError">`InvalidRequestError`</ApiLink> |
24+
| 401 | <ApiLink to="class/UnauthorizedError">`UnauthorizedError`</ApiLink> |
25+
| 403 | <ApiLink to="class/ForbiddenError">`ForbiddenError`</ApiLink> |
26+
| 404 | <ApiLink to="class/NotFoundError">`NotFoundError`</ApiLink> |
27+
| 409 | <ApiLink to="class/ConflictError">`ConflictError`</ApiLink> |
28+
| 429 | <ApiLink to="class/RateLimitError">`RateLimitError`</ApiLink> |
29+
| 5xx | <ApiLink to="class/ServerError">`ServerError`</ApiLink> |
30+
31+
All subclasses inherit from <ApiLink to="class/ApifyApiError">`ApifyApiError`</ApiLink>, so an existing `except ApifyApiError` handler still catches every API error. Catch a specific subclass when you want to react differently to, for example, a missing resource or a rate-limit:
32+
1633
<Tabs>
1734
<TabItem value="AsyncExample" label="Async client" default>
1835
<CodeBlock className="language-python">
@@ -25,3 +42,5 @@ When you use the Apify client, it automatically extracts all relevant data from
2542
</CodeBlock>
2643
</TabItem>
2744
</Tabs>
45+
46+
For a complete list of error classes, see the <ApiLink to="class/ApifyApiError">`ApifyApiError`</ApiLink> reference.

‎website/versioned_docs/version-2.5/02_concepts/05_retries.mdx‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
id: retries
33
title: Retries
4+
description: Configure automatic retries with exponential backoff for failed requests.
45
---
56

67
import Tabs from '@theme/Tabs';
@@ -12,23 +13,23 @@ import ApiLink from '@theme/ApiLink';
1213
import RetriesAsyncExample from '!!raw-loader!./code/05_retries_async.py';
1314
import RetriesSyncExample from '!!raw-loader!./code/05_retries_sync.py';
1415

15-
When dealing with network communication, failures can occasionally occur. The Apify client automatically retries requests that fail due to:
16+
The Apify client automatically retries requests that fail due to:
1617

1718
- Network errors
1819
- Internal errors in the Apify API (HTTP status codes 500 and above)
1920
- Rate limit errors (HTTP status code 429)
2021

21-
By default, the client will retry a failed request up to 8 times. The retry intervals use an exponential backoff strategy:
22+
By default, the client retries a failed request up to 4 times. The retry intervals use an exponential backoff strategy:
2223

2324
- The first retry occurs after approximately 500 milliseconds.
2425
- The second retry occurs after approximately 1,000 milliseconds, and so on.
2526

2627
You can customize this behavior using the following options in the <ApiLink to="class/ApifyClient">`ApifyClient`</ApiLink> constructor:
2728

2829
- `max_retries`: Defines the maximum number of retry attempts.
29-
- `min_delay_between_retries_millis`: Sets the minimum delay between retries (in milliseconds).
30+
- `min_delay_between_retries`: Sets the minimum delay between retries as a `timedelta`.
3031

31-
Retries with exponential backoff are a common strategy for handling network errors. They help to reduce the load on the server and increase the chances of a successful request.
32+
Retries with exponential backoff help reduce the load on the server and increase the chances of a successful request.
3233

3334
<Tabs>
3435
<TabItem value="AsyncExample" label="Async client" default>

‎website/versioned_docs/version-2.5/02_concepts/06_logging.mdx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
id: logging
33
title: Logging
4+
description: Configure debug logging to inspect API requests and responses.
45
---
56

67
import Tabs from '@theme/Tabs';

0 commit comments

Comments
 (0)