Skip to content

Latest commit

 

History

History
51 lines (42 loc) · 1.93 KB

File metadata and controls

51 lines (42 loc) · 1.93 KB
id single-and-collection-clients
title Single and collection clients
description Understand the two types of resource clients, single-resource and collection clients.

import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock';

import ApiLink from '@site/src/components/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'; import SingleSyncExample from '!!raw-loader!./code/02_single_sync.py';

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.

  • ActorClient - Manages a single resource.
  • ActorCollectionClient - Manages a collection of resources.
{CollectionAsyncExample} {CollectionSyncExample}

The resource ID can be the resource's id or a combination of username/resource-name.

{SingleAsyncExample} {SingleSyncExample}

By utilizing the appropriate collection or resource client, you can simplify how you interact with the Apify API.