Skip to content

Commit 64ee8ab

Browse files
vdusekclaude
andauthored
docs: Fix errors and standardize frontmatter across all pages (#695)
## Summary - **Fix error handling examples** — `except Exception as ApifyApiError` was catching all exceptions and shadowing the class name; now properly uses `from apify_client.errors import ApifyApiError` with `except ApifyApiError as err` - **Fix retries page** — default retry count corrected from 8 to 4 (matches `DEFAULT_MAX_RETRIES`); updated outdated `min_delay_between_retries_millis` to `min_delay_between_retries` (takes `timedelta`) - **Fix convenience methods page** — `start()` was described as waiting for finish (it doesn't); added missing `wait_for_finish()` method - **Fix nested client examples** — replaced `ty: ignore` comments with proper `ActorJobStatus.SUCCEEDED` enum usage - **Fix README** — updated Quick Start to typed attribute access (`actor_call.default_dataset_id`), corrected retry count and parameter name - **Fix comment grammar** — "waits" → "wait" in code examples - **Add `description` frontmatter** to all 20 doc pages for SEO - **Standardize guide titles** to imperative form ("Pass input to an Actor", "Integrate with data libraries", "Use HTTPX as the HTTP client") --- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f6806d3 commit 64ee8ab

28 files changed

+68
-37
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ apify_client = ApifyClient('MY-APIFY-TOKEN')
3333
actor_call = apify_client.actor('john-doe/my-cool-actor').call()
3434

3535
# Fetch results from the Actor's default dataset
36-
dataset_items = apify_client.dataset(actor_call['defaultDatasetId']).list_items().items
36+
if actor_call is not None:
37+
dataset_items = apify_client.dataset(actor_call.default_dataset_id).list_items().items
3738
```
3839

3940
## Features
@@ -46,7 +47,7 @@ Based on the endpoint, the client automatically extracts the relevant data and r
4647

4748
### Retries with exponential backoff
4849

49-
Network communication sometimes fails. The client will automatically retry requests that failed due to a network error, an internal error of the Apify API (HTTP 500+) or rate limit error (HTTP 429). By default, it will retry up to 8 times. First retry will be attempted after ~500ms, second after ~1000ms and so on. You can configure those parameters using the `max_retries` and `min_delay_between_retries_millis` options of the `ApifyClient` constructor.
50+
Network communication sometimes fails. The client will automatically retry requests that failed due to a network error, an internal error of the Apify API (HTTP 500+) or rate limit error (HTTP 429). By default, it will retry up to 4 times. First retry will be attempted after ~500ms, second after ~1000ms and so on. You can configure those parameters using the `max_retries` and `min_delay_between_retries` options of the `ApifyClient` constructor.
5051

5152
### Support for asynchronous usage
5253

docs/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)

docs/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)

docs/01_introduction/index.mdx

Lines changed: 1 addition & 2 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';

docs/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';

docs/02_concepts/01_async_support.mdx

Lines changed: 1 addition & 0 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';

docs/02_concepts/02_single_collection_clients.mdx

Lines changed: 1 addition & 0 deletions
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';

docs/02_concepts/03_nested_clients.mdx

Lines changed: 1 addition & 0 deletions
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';

docs/02_concepts/04_error_handling.mdx

Lines changed: 1 addition & 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';

docs/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';
@@ -10,23 +11,23 @@ import CodeBlock from '@theme/CodeBlock';
1011
import RetriesAsyncExample from '!!raw-loader!./code/05_retries_async.py';
1112
import RetriesSyncExample from '!!raw-loader!./code/05_retries_sync.py';
1213

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

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

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

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

2425
You can customize this behavior using the following options in the [`ApifyClient`](/reference/class/ApifyClient) constructor:
2526

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

29-
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.
30+
Retries with exponential backoff help reduce the load on the server and increase the chances of a successful request.
3031

3132
<Tabs>
3233
<TabItem value="AsyncExample" label="Async client" default>

0 commit comments

Comments
 (0)