From 645cd661583aeb1966dee06fabec2e8a858ff99f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jind=C5=99ich=20B=C3=A4r?= Date: Fri, 15 May 2026 14:26:13 +0200 Subject: [PATCH] docs: use the common `ApiLink` component from the shared theme --- docs/01_introduction/quick-start.mdx | 2 +- docs/02_concepts/01_async_support.mdx | 2 +- docs/02_concepts/02_single_collection_clients.mdx | 2 +- docs/02_concepts/03_nested_clients.mdx | 2 +- docs/02_concepts/04_error_handling.mdx | 2 +- docs/02_concepts/05_retries.mdx | 2 +- docs/02_concepts/07_convenience_methods.mdx | 2 +- docs/02_concepts/08_pagination.mdx | 2 +- docs/02_concepts/09_streaming.mdx | 2 +- docs/02_concepts/10_custom_http_clients.mdx | 2 +- docs/02_concepts/11_timeouts.mdx | 2 +- docs/02_concepts/12_typed_models.mdx | 2 +- docs/03_guides/05_custom_http_client.mdx | 2 +- docs/04_upgrading/upgrading_to_v2.mdx | 2 +- docs/04_upgrading/upgrading_to_v3.mdx | 2 +- website/src/components/ApiLink.jsx | 10 ---------- .../version-1.12/01_introduction/quick-start.mdx | 8 +++++--- .../version-1.12/02_concepts/01_async_support.mdx | 3 ++- .../02_concepts/02_single_collection_clients.mdx | 6 ++++-- .../version-1.12/02_concepts/03_nested_clients.mdx | 4 +++- .../version-1.12/02_concepts/04_error_handling.mdx | 3 ++- .../version-1.12/02_concepts/05_retries.mdx | 4 +++- .../02_concepts/07_convenience_methods.mdx | 6 ++++-- .../version-1.12/02_concepts/08_pagination.mdx | 6 ++++-- .../version-1.12/02_concepts/09_streaming.mdx | 8 +++++--- .../version-2.5/01_introduction/quick-start.mdx | 8 +++++--- .../version-2.5/02_concepts/01_async_support.mdx | 3 ++- .../02_concepts/02_single_collection_clients.mdx | 6 ++++-- .../version-2.5/02_concepts/03_nested_clients.mdx | 4 +++- .../version-2.5/02_concepts/04_error_handling.mdx | 3 ++- .../version-2.5/02_concepts/05_retries.mdx | 4 +++- .../version-2.5/02_concepts/07_convenience_methods.mdx | 6 ++++-- .../version-2.5/02_concepts/08_pagination.mdx | 6 ++++-- .../version-2.5/02_concepts/09_streaming.mdx | 8 +++++--- .../version-2.5/04_upgrading/upgrading_to_v2.mdx | 2 +- 35 files changed, 80 insertions(+), 58 deletions(-) delete mode 100644 website/src/components/ApiLink.jsx diff --git a/docs/01_introduction/quick-start.mdx b/docs/01_introduction/quick-start.mdx index d8feaa16..7083c16c 100644 --- a/docs/01_introduction/quick-start.mdx +++ b/docs/01_introduction/quick-start.mdx @@ -8,7 +8,7 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; -import ApiLink from '@site/src/components/ApiLink'; +import ApiLink from '@theme/ApiLink'; import AuthAsyncExample from '!!raw-loader!./code/02_auth_async.py'; import AuthSyncExample from '!!raw-loader!./code/02_auth_sync.py'; diff --git a/docs/02_concepts/01_async_support.mdx b/docs/02_concepts/01_async_support.mdx index a7c4677f..1d7efa13 100644 --- a/docs/02_concepts/01_async_support.mdx +++ b/docs/02_concepts/01_async_support.mdx @@ -7,7 +7,7 @@ description: Use the async client for non-blocking API calls with Python asyncio import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; -import ApiLink from '@site/src/components/ApiLink'; +import ApiLink from '@theme/ApiLink'; import AsyncSupportExample from '!!raw-loader!./code/01_async_support.py'; diff --git a/docs/02_concepts/02_single_collection_clients.mdx b/docs/02_concepts/02_single_collection_clients.mdx index 31df8d24..1cdadc50 100644 --- a/docs/02_concepts/02_single_collection_clients.mdx +++ b/docs/02_concepts/02_single_collection_clients.mdx @@ -8,7 +8,7 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; -import ApiLink from '@site/src/components/ApiLink'; +import ApiLink from '@theme/ApiLink'; import CollectionAsyncExample from '!!raw-loader!./code/02_collection_async.py'; import CollectionSyncExample from '!!raw-loader!./code/02_collection_sync.py'; diff --git a/docs/02_concepts/03_nested_clients.mdx b/docs/02_concepts/03_nested_clients.mdx index 432dd52f..95e512d1 100644 --- a/docs/02_concepts/03_nested_clients.mdx +++ b/docs/02_concepts/03_nested_clients.mdx @@ -8,7 +8,7 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; -import ApiLink from '@site/src/components/ApiLink'; +import ApiLink from '@theme/ApiLink'; import NestedAsyncExample from '!!raw-loader!./code/03_nested_async.py'; import NestedSyncExample from '!!raw-loader!./code/03_nested_sync.py'; diff --git a/docs/02_concepts/04_error_handling.mdx b/docs/02_concepts/04_error_handling.mdx index 3f2c9eef..9c41ac19 100644 --- a/docs/02_concepts/04_error_handling.mdx +++ b/docs/02_concepts/04_error_handling.mdx @@ -7,7 +7,7 @@ description: Handle API errors with the ApifyApiError exception and automatic da import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; -import ApiLink from '@site/src/components/ApiLink'; +import ApiLink from '@theme/ApiLink'; import ErrorAsyncExample from '!!raw-loader!./code/04_error_async.py'; import ErrorSyncExample from '!!raw-loader!./code/04_error_sync.py'; diff --git a/docs/02_concepts/05_retries.mdx b/docs/02_concepts/05_retries.mdx index bc7d2245..dfdf0917 100644 --- a/docs/02_concepts/05_retries.mdx +++ b/docs/02_concepts/05_retries.mdx @@ -8,7 +8,7 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; -import ApiLink from '@site/src/components/ApiLink'; +import ApiLink from '@theme/ApiLink'; import RetriesAsyncExample from '!!raw-loader!./code/05_retries_async.py'; import RetriesSyncExample from '!!raw-loader!./code/05_retries_sync.py'; diff --git a/docs/02_concepts/07_convenience_methods.mdx b/docs/02_concepts/07_convenience_methods.mdx index 323a447c..24a25593 100644 --- a/docs/02_concepts/07_convenience_methods.mdx +++ b/docs/02_concepts/07_convenience_methods.mdx @@ -8,7 +8,7 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; -import ApiLink from '@site/src/components/ApiLink'; +import ApiLink from '@theme/ApiLink'; import CallAsyncExample from '!!raw-loader!./code/07_call_async.py'; import CallSyncExample from '!!raw-loader!./code/07_call_sync.py'; diff --git a/docs/02_concepts/08_pagination.mdx b/docs/02_concepts/08_pagination.mdx index 92f7bdd6..cbf81253 100644 --- a/docs/02_concepts/08_pagination.mdx +++ b/docs/02_concepts/08_pagination.mdx @@ -8,7 +8,7 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; -import ApiLink from '@site/src/components/ApiLink'; +import ApiLink from '@theme/ApiLink'; import PaginationAsyncExample from '!!raw-loader!./code/08_pagination_async.py'; import PaginationSyncExample from '!!raw-loader!./code/08_pagination_sync.py'; diff --git a/docs/02_concepts/09_streaming.mdx b/docs/02_concepts/09_streaming.mdx index c1435f50..53ea1fcf 100644 --- a/docs/02_concepts/09_streaming.mdx +++ b/docs/02_concepts/09_streaming.mdx @@ -8,7 +8,7 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; -import ApiLink from '@site/src/components/ApiLink'; +import ApiLink from '@theme/ApiLink'; import StreamingAsyncExample from '!!raw-loader!./code/09_streaming_async.py'; import StreamingSyncExample from '!!raw-loader!./code/09_streaming_sync.py'; diff --git a/docs/02_concepts/10_custom_http_clients.mdx b/docs/02_concepts/10_custom_http_clients.mdx index 81f18ccb..d2d82a78 100644 --- a/docs/02_concepts/10_custom_http_clients.mdx +++ b/docs/02_concepts/10_custom_http_clients.mdx @@ -7,7 +7,7 @@ description: Replace the default HTTP client with a custom implementation. import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; -import ApiLink from '@site/src/components/ApiLink'; +import ApiLink from '@theme/ApiLink'; import DefaultHttpClientAsyncExample from '!!raw-loader!./code/10_default_http_client_async.py'; import DefaultHttpClientSyncExample from '!!raw-loader!./code/10_default_http_client_sync.py'; diff --git a/docs/02_concepts/11_timeouts.mdx b/docs/02_concepts/11_timeouts.mdx index 2d40bc63..54e56ea7 100644 --- a/docs/02_concepts/11_timeouts.mdx +++ b/docs/02_concepts/11_timeouts.mdx @@ -7,7 +7,7 @@ description: Configure the tiered timeout system for controlling how long API re import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; -import ApiLink from '@site/src/components/ApiLink'; +import ApiLink from '@theme/ApiLink'; import TimeoutsAsyncExample from '!!raw-loader!./code/11_timeouts_async.py'; import TimeoutsSyncExample from '!!raw-loader!./code/11_timeouts_sync.py'; diff --git a/docs/02_concepts/12_typed_models.mdx b/docs/02_concepts/12_typed_models.mdx index 4098bb75..58df78ec 100644 --- a/docs/02_concepts/12_typed_models.mdx +++ b/docs/02_concepts/12_typed_models.mdx @@ -7,7 +7,7 @@ description: Resource client methods return Pydantic models generated from the A import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; -import ApiLink from '@site/src/components/ApiLink'; +import ApiLink from '@theme/ApiLink'; import AccessAsyncExample from '!!raw-loader!./code/12_typed_models_access_async.py'; import AccessSyncExample from '!!raw-loader!./code/12_typed_models_access_sync.py'; diff --git a/docs/03_guides/05_custom_http_client.mdx b/docs/03_guides/05_custom_http_client.mdx index 77fd5432..9b34fec1 100644 --- a/docs/03_guides/05_custom_http_client.mdx +++ b/docs/03_guides/05_custom_http_client.mdx @@ -4,7 +4,7 @@ title: Use HTTPX as the HTTP client description: Replace the default Impit HTTP client with one based on HTTPX. --- -import ApiLink from '@site/src/components/ApiLink'; +import ApiLink from '@theme/ApiLink'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; diff --git a/docs/04_upgrading/upgrading_to_v2.mdx b/docs/04_upgrading/upgrading_to_v2.mdx index a0f81ba3..ed02202b 100644 --- a/docs/04_upgrading/upgrading_to_v2.mdx +++ b/docs/04_upgrading/upgrading_to_v2.mdx @@ -4,7 +4,7 @@ title: Upgrading to v2 description: Breaking changes and migration guide from v1 to v2. --- -import ApiLink from '@site/src/components/ApiLink'; +import ApiLink from '@theme/ApiLink'; This page summarizes the breaking changes between Apify Python API Client v1.x and v2.0. diff --git a/docs/04_upgrading/upgrading_to_v3.mdx b/docs/04_upgrading/upgrading_to_v3.mdx index c5caeebb..058e2be9 100644 --- a/docs/04_upgrading/upgrading_to_v3.mdx +++ b/docs/04_upgrading/upgrading_to_v3.mdx @@ -4,7 +4,7 @@ title: Upgrading to v3 description: Breaking changes and migration guide from v2 to v3. --- -import ApiLink from '@site/src/components/ApiLink'; +import ApiLink from '@theme/ApiLink'; This page summarizes the breaking changes between Apify Python API Client v2.x and v3.0. diff --git a/website/src/components/ApiLink.jsx b/website/src/components/ApiLink.jsx deleted file mode 100644 index 44bba352..00000000 --- a/website/src/components/ApiLink.jsx +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react'; -import Link from '@docusaurus/Link'; - -const ApiLink = ({ to, children }) => { - return ( - {children} - ); -}; - -export default ApiLink; diff --git a/website/versioned_docs/version-1.12/01_introduction/quick-start.mdx b/website/versioned_docs/version-1.12/01_introduction/quick-start.mdx index 6c1bad8e..98a9cb75 100644 --- a/website/versioned_docs/version-1.12/01_introduction/quick-start.mdx +++ b/website/versioned_docs/version-1.12/01_introduction/quick-start.mdx @@ -9,6 +9,8 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; +import ApiLink from '@theme/ApiLink'; + import AuthAsyncExample from '!!raw-loader!./code/02_auth_async.py'; import AuthSyncExample from '!!raw-loader!./code/02_auth_sync.py'; import UsageAsyncExample from '!!raw-loader!./code/01_usage_async.py'; @@ -47,7 +49,7 @@ The API token is used to authorize your requests to the Apify API. You can be ch ## Step 2: Run an Actor -To start an Actor, you need its ID (e.g., `john-doe/my-cool-actor`) and an API token. The Actor's ID is a combination of the username and the Actor owner's username. Use the [`ActorClient`](/reference/class/ActorClient) to run the Actor and wait for it to complete. You can run both your own Actors and [Actors from Apify store](https://docs.apify.com/platform/actors/running/actors-in-store). +To start an Actor, you need its ID (e.g., `john-doe/my-cool-actor`) and an API token. The Actor's ID is a combination of the username and the Actor owner's username. Use the `ActorClient` to run the Actor and wait for it to complete. You can run both your own Actors and [Actors from Apify store](https://docs.apify.com/platform/actors/running/actors-in-store). @@ -64,7 +66,7 @@ To start an Actor, you need its ID (e.g., `john-doe/my-cool-actor`) and an API t ## Step 3: Provide input to an Actor -Actors often require input, such as URLs to scrape, search terms, or other configuration data. You can pass input as a JSON object when starting the Actor using the [`ActorClient.call`](/reference/class/ActorClient#call) method. Actors respect the input schema defined in the Actor's [input schema](https://docs.apify.com/platform/actors/development/actor-definition/input-schema). +Actors often require input, such as URLs to scrape, search terms, or other configuration data. You can pass input as a JSON object when starting the Actor using the `ActorClient.call` method. Actors respect the input schema defined in the Actor's [input schema](https://docs.apify.com/platform/actors/development/actor-definition/input-schema). @@ -81,7 +83,7 @@ Actors often require input, such as URLs to scrape, search terms, or other confi ## Step 4: Get results from the dataset -To get the results from the dataset, you can use the [`DatasetClient`](/reference/class/DatasetClient) ([`ApifyClient.dataset`](/reference/class/ApifyClient#dataset)) and [`DatasetClient.list_items`](/reference/class/DatasetClient#list_items) method. You need to pass the dataset ID to define which dataset you want to access. You can get the dataset ID from the Actor's run dictionary (represented by `defaultDatasetId`). +To get the results from the dataset, you can use the `DatasetClient` (`ApifyClient.dataset`) and `DatasetClient.list_items` method. You need to pass the dataset ID to define which dataset you want to access. You can get the dataset ID from the Actor's run dictionary (represented by `defaultDatasetId`). diff --git a/website/versioned_docs/version-1.12/02_concepts/01_async_support.mdx b/website/versioned_docs/version-1.12/02_concepts/01_async_support.mdx index bdb6ab3a..dbd7679d 100644 --- a/website/versioned_docs/version-1.12/02_concepts/01_async_support.mdx +++ b/website/versioned_docs/version-1.12/02_concepts/01_async_support.mdx @@ -6,10 +6,11 @@ title: Asyncio support import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; +import ApiLink from '@theme/ApiLink'; import AsyncSupportExample from '!!raw-loader!./code/01_async_support.py'; -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. +The package provides an asynchronous version of the client, `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. The following example demonstrates how to run an Actor asynchronously and stream its logs while it is running: diff --git a/website/versioned_docs/version-1.12/02_concepts/02_single_collection_clients.mdx b/website/versioned_docs/version-1.12/02_concepts/02_single_collection_clients.mdx index 1a5ac0a2..e53e5ecf 100644 --- a/website/versioned_docs/version-1.12/02_concepts/02_single_collection_clients.mdx +++ b/website/versioned_docs/version-1.12/02_concepts/02_single_collection_clients.mdx @@ -7,6 +7,8 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; +import ApiLink from '@theme/ApiLink'; + import CollectionAsyncExample from '!!raw-loader!./code/02_collection_async.py'; import CollectionSyncExample from '!!raw-loader!./code/02_collection_sync.py'; import SingleAsyncExample from '!!raw-loader!./code/02_single_async.py'; @@ -14,8 +16,8 @@ import SingleSyncExample from '!!raw-loader!./code/02_single_sync.py'; 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: -- [`ActorClient`](/reference/class/ActorClient) - Manages a single resource. -- [`ActorCollectionClient`](/reference/class/ActorCollectionClient) - Manages a collection of resources. +- `ActorClient` - Manages a single resource. +- `ActorCollectionClient` - Manages a collection of resources. diff --git a/website/versioned_docs/version-1.12/02_concepts/03_nested_clients.mdx b/website/versioned_docs/version-1.12/02_concepts/03_nested_clients.mdx index 386aefd1..56a9e152 100644 --- a/website/versioned_docs/version-1.12/02_concepts/03_nested_clients.mdx +++ b/website/versioned_docs/version-1.12/02_concepts/03_nested_clients.mdx @@ -7,6 +7,8 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; +import ApiLink from '@theme/ApiLink'; + import NestedAsyncExample from '!!raw-loader!./code/03_nested_async.py'; import NestedSyncExample from '!!raw-loader!./code/03_nested_sync.py'; @@ -25,4 +27,4 @@ In some cases, the Apify client provides nested clients to simplify working with -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. +This direct access to [Dataset](https://docs.apify.com/platform/storage/dataset) (and other storage resources) from the `RunClient` is especially convenient when used alongside the `ActorClient.last_run` method. diff --git a/website/versioned_docs/version-1.12/02_concepts/04_error_handling.mdx b/website/versioned_docs/version-1.12/02_concepts/04_error_handling.mdx index d8859eb1..89eb543a 100644 --- a/website/versioned_docs/version-1.12/02_concepts/04_error_handling.mdx +++ b/website/versioned_docs/version-1.12/02_concepts/04_error_handling.mdx @@ -6,11 +6,12 @@ title: Error handling import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; +import ApiLink from '@theme/ApiLink'; import ErrorAsyncExample from '!!raw-loader!./code/04_error_async.py'; import ErrorSyncExample from '!!raw-loader!./code/04_error_sync.py'; -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. +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`. This exception wraps the raw JSON errors returned by the API and provides additional context, making it easier to debug any issues that arise. diff --git a/website/versioned_docs/version-1.12/02_concepts/05_retries.mdx b/website/versioned_docs/version-1.12/02_concepts/05_retries.mdx index 9cf0ed11..d7d99a29 100644 --- a/website/versioned_docs/version-1.12/02_concepts/05_retries.mdx +++ b/website/versioned_docs/version-1.12/02_concepts/05_retries.mdx @@ -7,6 +7,8 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; +import ApiLink from '@theme/ApiLink'; + import RetriesAsyncExample from '!!raw-loader!./code/05_retries_async.py'; import RetriesSyncExample from '!!raw-loader!./code/05_retries_sync.py'; @@ -21,7 +23,7 @@ By default, the client will retry a failed request up to 8 times. The retry inte - The first retry occurs after approximately 500 milliseconds. - The second retry occurs after approximately 1,000 milliseconds, and so on. -You can customize this behavior using the following options in the [`ApifyClient`](/reference/class/ApifyClient) constructor: +You can customize this behavior using the following options in the `ApifyClient` constructor: - `max_retries`: Defines the maximum number of retry attempts. - `min_delay_between_retries_millis`: Sets the minimum delay between retries (in milliseconds). diff --git a/website/versioned_docs/version-1.12/02_concepts/07_convenience_methods.mdx b/website/versioned_docs/version-1.12/02_concepts/07_convenience_methods.mdx index b3014471..3ad81405 100644 --- a/website/versioned_docs/version-1.12/02_concepts/07_convenience_methods.mdx +++ b/website/versioned_docs/version-1.12/02_concepts/07_convenience_methods.mdx @@ -7,13 +7,15 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; +import ApiLink from '@theme/ApiLink'; + import CallAsyncExample from '!!raw-loader!./code/07_call_async.py'; import CallSyncExample from '!!raw-loader!./code/07_call_sync.py'; 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. -- [`ActorClient.call`](/reference/class/ActorClient#call) - Starts an Actor and waits for it to finish, handling network timeouts internally. -- [`ActorClient.start`](/reference/class/ActorClient#start) - Explicitly waits for an Actor run to finish with customizable timeouts. +- `ActorClient.call` - Starts an Actor and waits for it to finish, handling network timeouts internally. +- `ActorClient.start` - Explicitly waits for an Actor run to finish with customizable timeouts. Additionally, storage-related resources offer flexible options for data retrieval: diff --git a/website/versioned_docs/version-1.12/02_concepts/08_pagination.mdx b/website/versioned_docs/version-1.12/02_concepts/08_pagination.mdx index 712aee81..6747d7ee 100644 --- a/website/versioned_docs/version-1.12/02_concepts/08_pagination.mdx +++ b/website/versioned_docs/version-1.12/02_concepts/08_pagination.mdx @@ -7,10 +7,12 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; +import ApiLink from '@theme/ApiLink'; + import PaginationAsyncExample from '!!raw-loader!./code/08_pagination_async.py'; import PaginationSyncExample from '!!raw-loader!./code/08_pagination_sync.py'; -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: +Most methods named `list` or `list_something` in the Apify client return a `ListPage` object. This object provides a consistent interface for working with paginated data and includes the following properties: - `items` - The main results you're looking for. - `total` - The total number of items available. @@ -35,4 +37,4 @@ The following example demonstrates how to fetch all items from a dataset using p -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. +The `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. diff --git a/website/versioned_docs/version-1.12/02_concepts/09_streaming.mdx b/website/versioned_docs/version-1.12/02_concepts/09_streaming.mdx index b365e34a..1cd823dc 100644 --- a/website/versioned_docs/version-1.12/02_concepts/09_streaming.mdx +++ b/website/versioned_docs/version-1.12/02_concepts/09_streaming.mdx @@ -7,6 +7,8 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; +import ApiLink from '@theme/ApiLink'; + import StreamingAsyncExample from '!!raw-loader!./code/09_streaming_async.py'; import StreamingSyncExample from '!!raw-loader!./code/09_streaming_sync.py'; @@ -14,9 +16,9 @@ Certain resources, such as dataset items, key-value store records, and logs, sup Supported streaming methods: -- [`DatasetClient.stream_items`](/reference/class/DatasetClient#stream_items) - Stream dataset items incrementally. -- [`KeyValueStoreClient.stream_record`](/reference/class/KeyValueStoreClient#stream_record) - Stream key-value store records as raw data. -- [`LogClient.stream`](/reference/class/LogClient#stream) - Stream logs in real time. +- `DatasetClient.stream_items` - Stream dataset items incrementally. +- `KeyValueStoreClient.stream_record` - Stream key-value store records as raw data. +- `LogClient.stream` - Stream logs in real time. These methods return a raw, context-managed `httpx.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. diff --git a/website/versioned_docs/version-2.5/01_introduction/quick-start.mdx b/website/versioned_docs/version-2.5/01_introduction/quick-start.mdx index 5832c2a7..7365e56e 100644 --- a/website/versioned_docs/version-2.5/01_introduction/quick-start.mdx +++ b/website/versioned_docs/version-2.5/01_introduction/quick-start.mdx @@ -9,6 +9,8 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; +import ApiLink from '@theme/ApiLink'; + import AuthAsyncExample from '!!raw-loader!./code/02_auth_async.py'; import AuthSyncExample from '!!raw-loader!./code/02_auth_sync.py'; import InputAsyncExample from '!!raw-loader!./code/03_input_async.py'; @@ -45,9 +47,9 @@ The API token is used to authorize your requests to the Apify API. You can be ch ## Step 2: Run an Actor -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). +To start an Actor, call the `apify_client.actor()` 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). -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. +To define the Actor's input, pass a dictionary to the `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. @@ -64,7 +66,7 @@ To define the Actor's input, pass a dictionary to the [`call()`](/reference/clas ## Step 3: Get results from the dataset -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`). +To get the results from the dataset, call the `apify_client.dataset()` method with the dataset ID, then call `list_items()` to retrieve the data. You can get the dataset ID from the Actor's run dictionary (represented by `defaultDatasetId`). diff --git a/website/versioned_docs/version-2.5/02_concepts/01_async_support.mdx b/website/versioned_docs/version-2.5/02_concepts/01_async_support.mdx index bdb6ab3a..dbd7679d 100644 --- a/website/versioned_docs/version-2.5/02_concepts/01_async_support.mdx +++ b/website/versioned_docs/version-2.5/02_concepts/01_async_support.mdx @@ -6,10 +6,11 @@ title: Asyncio support import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; +import ApiLink from '@theme/ApiLink'; import AsyncSupportExample from '!!raw-loader!./code/01_async_support.py'; -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. +The package provides an asynchronous version of the client, `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. The following example demonstrates how to run an Actor asynchronously and stream its logs while it is running: diff --git a/website/versioned_docs/version-2.5/02_concepts/02_single_collection_clients.mdx b/website/versioned_docs/version-2.5/02_concepts/02_single_collection_clients.mdx index 1a5ac0a2..e53e5ecf 100644 --- a/website/versioned_docs/version-2.5/02_concepts/02_single_collection_clients.mdx +++ b/website/versioned_docs/version-2.5/02_concepts/02_single_collection_clients.mdx @@ -7,6 +7,8 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; +import ApiLink from '@theme/ApiLink'; + import CollectionAsyncExample from '!!raw-loader!./code/02_collection_async.py'; import CollectionSyncExample from '!!raw-loader!./code/02_collection_sync.py'; import SingleAsyncExample from '!!raw-loader!./code/02_single_async.py'; @@ -14,8 +16,8 @@ import SingleSyncExample from '!!raw-loader!./code/02_single_sync.py'; 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: -- [`ActorClient`](/reference/class/ActorClient) - Manages a single resource. -- [`ActorCollectionClient`](/reference/class/ActorCollectionClient) - Manages a collection of resources. +- `ActorClient` - Manages a single resource. +- `ActorCollectionClient` - Manages a collection of resources. diff --git a/website/versioned_docs/version-2.5/02_concepts/03_nested_clients.mdx b/website/versioned_docs/version-2.5/02_concepts/03_nested_clients.mdx index 386aefd1..56a9e152 100644 --- a/website/versioned_docs/version-2.5/02_concepts/03_nested_clients.mdx +++ b/website/versioned_docs/version-2.5/02_concepts/03_nested_clients.mdx @@ -7,6 +7,8 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; +import ApiLink from '@theme/ApiLink'; + import NestedAsyncExample from '!!raw-loader!./code/03_nested_async.py'; import NestedSyncExample from '!!raw-loader!./code/03_nested_sync.py'; @@ -25,4 +27,4 @@ In some cases, the Apify client provides nested clients to simplify working with -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. +This direct access to [Dataset](https://docs.apify.com/platform/storage/dataset) (and other storage resources) from the `RunClient` is especially convenient when used alongside the `ActorClient.last_run` method. diff --git a/website/versioned_docs/version-2.5/02_concepts/04_error_handling.mdx b/website/versioned_docs/version-2.5/02_concepts/04_error_handling.mdx index d8859eb1..89eb543a 100644 --- a/website/versioned_docs/version-2.5/02_concepts/04_error_handling.mdx +++ b/website/versioned_docs/version-2.5/02_concepts/04_error_handling.mdx @@ -6,11 +6,12 @@ title: Error handling import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; +import ApiLink from '@theme/ApiLink'; import ErrorAsyncExample from '!!raw-loader!./code/04_error_async.py'; import ErrorSyncExample from '!!raw-loader!./code/04_error_sync.py'; -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. +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`. This exception wraps the raw JSON errors returned by the API and provides additional context, making it easier to debug any issues that arise. diff --git a/website/versioned_docs/version-2.5/02_concepts/05_retries.mdx b/website/versioned_docs/version-2.5/02_concepts/05_retries.mdx index 9cf0ed11..d7d99a29 100644 --- a/website/versioned_docs/version-2.5/02_concepts/05_retries.mdx +++ b/website/versioned_docs/version-2.5/02_concepts/05_retries.mdx @@ -7,6 +7,8 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; +import ApiLink from '@theme/ApiLink'; + import RetriesAsyncExample from '!!raw-loader!./code/05_retries_async.py'; import RetriesSyncExample from '!!raw-loader!./code/05_retries_sync.py'; @@ -21,7 +23,7 @@ By default, the client will retry a failed request up to 8 times. The retry inte - The first retry occurs after approximately 500 milliseconds. - The second retry occurs after approximately 1,000 milliseconds, and so on. -You can customize this behavior using the following options in the [`ApifyClient`](/reference/class/ApifyClient) constructor: +You can customize this behavior using the following options in the `ApifyClient` constructor: - `max_retries`: Defines the maximum number of retry attempts. - `min_delay_between_retries_millis`: Sets the minimum delay between retries (in milliseconds). diff --git a/website/versioned_docs/version-2.5/02_concepts/07_convenience_methods.mdx b/website/versioned_docs/version-2.5/02_concepts/07_convenience_methods.mdx index b3014471..3ad81405 100644 --- a/website/versioned_docs/version-2.5/02_concepts/07_convenience_methods.mdx +++ b/website/versioned_docs/version-2.5/02_concepts/07_convenience_methods.mdx @@ -7,13 +7,15 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; +import ApiLink from '@theme/ApiLink'; + import CallAsyncExample from '!!raw-loader!./code/07_call_async.py'; import CallSyncExample from '!!raw-loader!./code/07_call_sync.py'; 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. -- [`ActorClient.call`](/reference/class/ActorClient#call) - Starts an Actor and waits for it to finish, handling network timeouts internally. -- [`ActorClient.start`](/reference/class/ActorClient#start) - Explicitly waits for an Actor run to finish with customizable timeouts. +- `ActorClient.call` - Starts an Actor and waits for it to finish, handling network timeouts internally. +- `ActorClient.start` - Explicitly waits for an Actor run to finish with customizable timeouts. Additionally, storage-related resources offer flexible options for data retrieval: diff --git a/website/versioned_docs/version-2.5/02_concepts/08_pagination.mdx b/website/versioned_docs/version-2.5/02_concepts/08_pagination.mdx index 712aee81..6747d7ee 100644 --- a/website/versioned_docs/version-2.5/02_concepts/08_pagination.mdx +++ b/website/versioned_docs/version-2.5/02_concepts/08_pagination.mdx @@ -7,10 +7,12 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; +import ApiLink from '@theme/ApiLink'; + import PaginationAsyncExample from '!!raw-loader!./code/08_pagination_async.py'; import PaginationSyncExample from '!!raw-loader!./code/08_pagination_sync.py'; -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: +Most methods named `list` or `list_something` in the Apify client return a `ListPage` object. This object provides a consistent interface for working with paginated data and includes the following properties: - `items` - The main results you're looking for. - `total` - The total number of items available. @@ -35,4 +37,4 @@ The following example demonstrates how to fetch all items from a dataset using p -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. +The `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. diff --git a/website/versioned_docs/version-2.5/02_concepts/09_streaming.mdx b/website/versioned_docs/version-2.5/02_concepts/09_streaming.mdx index c62da01e..20ff30ec 100644 --- a/website/versioned_docs/version-2.5/02_concepts/09_streaming.mdx +++ b/website/versioned_docs/version-2.5/02_concepts/09_streaming.mdx @@ -7,6 +7,8 @@ import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock'; +import ApiLink from '@theme/ApiLink'; + import StreamingAsyncExample from '!!raw-loader!./code/09_streaming_async.py'; import StreamingSyncExample from '!!raw-loader!./code/09_streaming_sync.py'; @@ -14,9 +16,9 @@ Certain resources, such as dataset items, key-value store records, and logs, sup Supported streaming methods: -- [`DatasetClient.stream_items`](/reference/class/DatasetClient#stream_items) - Stream dataset items incrementally. -- [`KeyValueStoreClient.stream_record`](/reference/class/KeyValueStoreClient#stream_record) - Stream key-value store records as raw data. -- [`LogClient.stream`](/reference/class/LogClient#stream) - Stream logs in real time. +- `DatasetClient.stream_items` - Stream dataset items incrementally. +- `KeyValueStoreClient.stream_record` - Stream key-value store records as raw data. +- `LogClient.stream` - Stream logs in real time. 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. diff --git a/website/versioned_docs/version-2.5/04_upgrading/upgrading_to_v2.mdx b/website/versioned_docs/version-2.5/04_upgrading/upgrading_to_v2.mdx index 6649fb01..6631c716 100644 --- a/website/versioned_docs/version-2.5/04_upgrading/upgrading_to_v2.mdx +++ b/website/versioned_docs/version-2.5/04_upgrading/upgrading_to_v2.mdx @@ -4,7 +4,7 @@ title: Upgrading to v2 description: Breaking changes and migration guide from v1 to v2. --- -import ApiLink from '@site/src/components/ApiLink'; +import ApiLink from '@theme/ApiLink'; This page summarizes the breaking changes between Apify Python API Client v1.x and v2.0.