|
1 | 1 | --- |
2 | 2 | id: introduction |
3 | | -title: Overview |
| 3 | +title: Apify SDK for Python |
4 | 4 | sidebar_label: Overview |
| 5 | +slug: /overview |
5 | 6 | description: 'The official library for creating Apify Actors in Python, providing tools for web scraping, automation, and data storage integration.' |
6 | 7 | --- |
7 | 8 |
|
8 | | -The Apify SDK for Python is the official library for creating [Apify Actors](https://docs.apify.com/platform/actors) in Python. |
| 9 | +The Apify SDK for Python is the official library for creating [Apify Actors](https://docs.apify.com/platform/actors) using Python. It provides useful features like Actor lifecycle management, local storage emulation, and Actor event handling. |
9 | 10 |
|
10 | | -It provides tools and classes for web scraping and automation, allowing you to manage Actor lifecycles, handle data storage, work with proxies, and integrate with popular Python libraries. |
11 | | - |
12 | | -## Example |
13 | | - |
14 | | -Here's a simple example of an Actor that scrapes a web page and stores the result: |
15 | | - |
16 | | -```py |
| 11 | +```python |
17 | 12 | from apify import Actor |
18 | | -from bs4 import BeautifulSoup |
19 | | -import requests |
20 | 13 |
|
21 | 14 | async def main(): |
22 | 15 | async with Actor: |
23 | | - input = await Actor.get_input() |
24 | | - response = requests.get(input['url']) |
25 | | - soup = BeautifulSoup(response.content, 'html.parser') |
26 | | - await Actor.push_data({ 'url': input['url'], 'title': soup.title.string }) |
| 16 | + actor_input = await Actor.get_input() |
| 17 | + print(actor_input) |
27 | 18 | ``` |
28 | 19 |
|
29 | | -## Features |
| 20 | +## What are Actors |
| 21 | + |
| 22 | +Actors are serverless cloud programs capable of performing tasks in a web browser, similar to what a human can do. These tasks can range from simple operations, such as filling out forms or unsubscribing from services, to complex jobs like scraping and processing large numbers of web pages. |
| 23 | + |
| 24 | +Actors can be executed locally or on the [Apify platform](https://docs.apify.com/platform). The Apify platform lets you run Actors at scale and provides features for monitoring, scheduling, publishing, and monetizing them. |
| 25 | + |
| 26 | +## Quick start |
30 | 27 |
|
31 | | -The Apify SDK for Python provides: |
| 28 | +To create and run Actors using Apify Console, check out [Apify Console documentation](https://docs.apify.com/platform/console). For creating and running Python Actors locally, refer to the [quick start guide](./quick-start). |
| 29 | + |
| 30 | +Explore the Guides section in the sidebar to see more of the SDK in action and for a deeper understanding of the SDK's features and best practices. |
| 31 | + |
| 32 | +## Installation |
| 33 | + |
| 34 | +The Apify SDK for Python is typically installed when you create a new Actor project using the [Apify CLI](https://docs.apify.com/cli). To install it manually in an existing project, use: |
| 35 | + |
| 36 | +```bash |
| 37 | +pip install apify |
| 38 | +``` |
32 | 39 |
|
33 | | -- **Actor lifecycle management** - Handle initialization, teardown, and graceful shutdowns |
34 | | -- **Storage management** - Work with Datasets, Key-Value Stores, and Request Queues |
35 | | -- **Event handling** - Respond to Actor events like migration, abort, and system info |
36 | | -- **Proxy management** - Rotate and manage proxies for web scraping |
37 | | -- **Platform integration** - Interact with other Actors, webhooks, and the Apify API |
38 | | -- **Framework compatibility** - Integrate with BeautifulSoup, Playwright, Selenium, Scrapy, and Crawlee |
| 40 | +:::note API client alternative |
39 | 41 |
|
40 | | -## Next steps |
| 42 | +If you need to interact with the Apify API programmatically without creating Actors, use the [Apify API client for Python](https://docs.apify.com/api/client/python) instead. |
41 | 43 |
|
42 | | -- **[Installation](./installation)** - Install the SDK and set up your development environment |
43 | | -- **[Quick start](./quick-start)** - Create and run your first Actor |
44 | | -- **[Concepts](../concepts/actor-lifecycle)** - Learn about core SDK concepts |
45 | | -- **[Guides](../guides/beautiful-soup)** - See how to integrate with popular libraries |
| 44 | +::: |
0 commit comments