Skip to content

Commit e4e2203

Browse files
committed
docs: consolidate overview page
1 parent 5134708 commit e4e2203

4 files changed

Lines changed: 153 additions & 171 deletions

File tree

docs/01_overview/01_introduction.mdx

Lines changed: 0 additions & 26 deletions
This file was deleted.

docs/01_overview/02_setting_up.mdx

Lines changed: 0 additions & 71 deletions
This file was deleted.

docs/01_overview/03_getting_started.mdx

Lines changed: 0 additions & 74 deletions
This file was deleted.

docs/01_overview/overview.mdx

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
---
2+
id: overview
3+
title: Overview
4+
---
5+
6+
import Tabs from '@theme/Tabs';
7+
import TabItem from '@theme/TabItem';
8+
import CodeBlock from '@theme/CodeBlock';
9+
10+
import AuthAsyncExample from '!!raw-loader!./code/02_auth_async.py';
11+
import AuthSyncExample from '!!raw-loader!./code/02_auth_sync.py';
12+
import UsageAsyncExample from '!!raw-loader!./code/01_usage_async.py';
13+
import UsageSyncExample from '!!raw-loader!./code/01_usage_sync.py';
14+
import InputAsyncExample from '!!raw-loader!./code/03_input_async.py';
15+
import InputSyncExample from '!!raw-loader!./code/03_input_sync.py';
16+
import DatasetAsyncExample from '!!raw-loader!./code/03_dataset_async.py';
17+
import DatasetSyncExample from '!!raw-loader!./code/03_dataset_sync.py';
18+
19+
## Introduction
20+
21+
The [Apify client for Python](https://github.com/apify/apify-client-python) is the official library to access the [Apify REST API](/api/v2) from your Python applications. It provides useful features like automatic retries and convenience functions that improve the experience of using the Apify API.
22+
23+
Key features:
24+
25+
- **Synchronous and asynchronous interfaces** for flexible integration
26+
- **Automatic retries** for improved reliability
27+
- **JSON encoding** with UTF-8 for all requests and responses
28+
- **Comprehensive API coverage** for [Actors](), [datasets](), [key-value stores](), and more
29+
30+
## Prerequisites
31+
32+
Before installing the Apify client, ensure your system meets the following requirements:
33+
34+
- **Python 3.10 or higher**: You can download Python from the [official website](https://www.python.org/downloads/).
35+
- **Python package manager**: While this guide uses Pip (the most common package manager), you can also use any package manager you want. You can download Pip from the [official website](https://pip.pypa.io/en/stable/installation/).
36+
37+
To verify that Python and Pip are installed, run the following commands:
38+
39+
```sh
40+
python --version
41+
```
42+
43+
```sh
44+
pip --version
45+
```
46+
47+
If these commands return the respective versions, you're ready to continue.
48+
49+
## Installation
50+
51+
The Apify client is available as the [`apify-client`](https://pypi.org/project/apify-client/) package on PyPI. To install it, run:
52+
53+
```sh
54+
pip install apify-client
55+
```
56+
57+
After installation, verify that the client is installed correctly by checking its version:
58+
59+
```sh
60+
python -c 'import apify_client; print(apify_client.__version__)'
61+
```
62+
63+
## Authentication and initialization
64+
65+
To use the client, you need an [API token](/platform/integrations/api#api-token). You can find your token under the [Integrations](https://console.apify.com/account/integrations) tab in Apify Console. Copy the token and initialize the client by providing it as a parameter to the `ApifyClient` constructor.
66+
67+
<Tabs>
68+
<TabItem value="AsyncExample" label="Async client" default>
69+
<CodeBlock className="language-python">
70+
{AuthAsyncExample}
71+
</CodeBlock>
72+
</TabItem>
73+
<TabItem value="SyncExample" label="Sync client">
74+
<CodeBlock className="language-python">
75+
{AuthSyncExample}
76+
</CodeBlock>
77+
</TabItem>
78+
</Tabs>
79+
80+
:::warning Secure access
81+
82+
The API token is used to authorize your requests to the Apify API. You can be charged for the usage of the underlying services, so do not share your API token with untrusted parties or expose it on the client side of your applications.
83+
84+
:::
85+
86+
## Quick start
87+
88+
Now that you have the client set up, let's explore how to run Actors on the Apify platform, provide input to them, and retrieve their results.
89+
90+
### Running your first Actor
91+
92+
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 Actor name 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).
93+
94+
<Tabs>
95+
<TabItem value="AsyncExample" label="Async client" default>
96+
<CodeBlock className="language-python">
97+
{UsageAsyncExample}
98+
</CodeBlock>
99+
</TabItem>
100+
<TabItem value="SyncExample" label="Sync client">
101+
<CodeBlock className="language-python">
102+
{UsageSyncExample}
103+
</CodeBlock>
104+
</TabItem>
105+
</Tabs>
106+
107+
### Providing input to Actor
108+
109+
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).
110+
111+
<Tabs>
112+
<TabItem value="AsyncExample" label="Async client" default>
113+
<CodeBlock className="language-python">
114+
{InputAsyncExample}
115+
</CodeBlock>
116+
</TabItem>
117+
<TabItem value="SyncExample" label="Sync client">
118+
<CodeBlock className="language-python">
119+
{InputSyncExample}
120+
</CodeBlock>
121+
</TabItem>
122+
</Tabs>
123+
124+
### Getting results from the dataset
125+
126+
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`).
127+
128+
<Tabs>
129+
<TabItem value="AsyncExample" label="Async client" default>
130+
<CodeBlock className="language-python">
131+
{DatasetAsyncExample}
132+
</CodeBlock>
133+
</TabItem>
134+
<TabItem value="SyncExample" label="Sync client">
135+
<CodeBlock className="language-python">
136+
{DatasetSyncExample}
137+
</CodeBlock>
138+
</TabItem>
139+
</Tabs>
140+
141+
:::note Dataset access
142+
143+
Running an Actor might take time, depending on the Actor's complexity and the amount of data it processes. If you want only to get data and have an immediate response, you should access the existing dataset of the finished [Actor run](https://docs.apify.com/platform/actors/running/runs-and-builds#runs).
144+
145+
:::
146+
147+
## Next steps
148+
149+
Now that you're familiar with the basics, explore more advanced features:
150+
151+
- [Async support](/concepts/async-support) - Learn about asynchronous programming with the client
152+
- [Examples](/examples/passing-input-to-actor) - See practical examples for common use cases
153+
- [API Reference](/reference/class/ApifyClient) - Browse the complete API documentation

0 commit comments

Comments
 (0)