# SDK for Python | Apify Documentation


## sdk

- [Search the documentation](https://docs.apify.com/sdk/python/search.md)
- [Changelog](https://docs.apify.com/sdk/python/docs/changelog.md): All notable changes to this project will be documented in this file.
- [Accessing Apify API](https://docs.apify.com/sdk/python/docs/concepts/access-apify-api.md): Use the built-in Apify API client to access platform features not covered by the SDK.
- [Actor configuration](https://docs.apify.com/sdk/python/docs/concepts/actor-configuration.md): Customize Actor behavior through the Configuration class or environment variables.
- [Actor events and state persistence](https://docs.apify.com/sdk/python/docs/concepts/actor-events.md): Handle platform events like state persistence and graceful shutdown in your Actors.
- [Actor input](https://docs.apify.com/sdk/python/docs/concepts/actor-input.md): Read and validate input data passed to your Actor at runtime.
- [Actor lifecycle](https://docs.apify.com/sdk/python/docs/concepts/actor-lifecycle.md): How an Apify Actor starts, runs, and shuts down, including context manager and manual control patterns.
- [Error handling](https://docs.apify.com/sdk/python/docs/concepts/error-handling.md): The exceptions an Actor can raise and how to handle them
- [Interacting with other Actors](https://docs.apify.com/sdk/python/docs/concepts/interacting-with-other-actors.md): Start, call, and metamorph other Actors from within your Actor code.
- [Logging](https://docs.apify.com/sdk/python/docs/concepts/logging.md): Configure log levels, formatting, and log redirection between Actor runs.
- [Pay-per-event monetization](https://docs.apify.com/sdk/python/docs/concepts/pay-per-event.md): Monetize your Actors using the pay-per-event pricing model.
- [Proxy management](https://docs.apify.com/sdk/python/docs/concepts/proxy-management.md): Configure Apify Proxy or your own proxies for IP rotation and session management.
- [Storage clients](https://docs.apify.com/sdk/python/docs/concepts/storage-clients.md): Choose and configure the backend the Actor uses for datasets, key-value stores, and request queues.
- [Storages](https://docs.apify.com/sdk/python/docs/concepts/storages.md): Use datasets, key-value stores, and request queues to persist Actor data.
- [Creating webhooks](https://docs.apify.com/sdk/python/docs/concepts/webhooks.md): Set up webhooks to trigger actions when Actor run events occur.
- [Hosting AI agents](https://docs.apify.com/sdk/python/docs/guides/ai-agents.md): Host AI agents built with LangGraph, CrewAI, PydanticAI, LlamaIndex, or Smolagents as Apify Actors.
- [Scraping with BeautifulSoup and HTTPX2](https://docs.apify.com/sdk/python/docs/guides/beautifulsoup-httpx.md): Build an Apify Actor that scrapes web pages using BeautifulSoup and HTTPX2.
- [Browser AI agents with Browser Use](https://docs.apify.com/sdk/python/docs/guides/browser-use.md): Build an Apify Actor that automates a browser with an LLM agent using the Browser Use library.
- [LLM-ready scraping with Crawl4AI](https://docs.apify.com/sdk/python/docs/guides/crawl4ai.md): Build an Apify Actor that scrapes web pages into LLM-ready Markdown using the Crawl4AI library.
- [Building crawlers with Crawlee](https://docs.apify.com/sdk/python/docs/guides/crawlee.md): Build Apify Actors using Crawlee's BeautifulSoupCrawler, ParselCrawler, or PlaywrightCrawler.
- [Input validation with Pydantic](https://docs.apify.com/sdk/python/docs/guides/input-validation.md): Parse, validate, and type your Actor's input with Pydantic models instead of reaching into a raw dictionary.
- [Deploying MCP servers](https://docs.apify.com/sdk/python/docs/guides/mcp-servers.md): Deploy a Python MCP server as an Apify Actor and make its tools available to any MCP client.
- [Scraping with Parsel and Impit](https://docs.apify.com/sdk/python/docs/guides/parsel-impit.md): Build an Apify Actor that scrapes web pages using Parsel selectors and the Impit HTTP client.
- [Browser automation with Playwright](https://docs.apify.com/sdk/python/docs/guides/playwright.md): Build an Apify Actor that scrapes dynamic web pages using Playwright browser automation.
- [Running a web server](https://docs.apify.com/sdk/python/docs/guides/running-webserver.md): Run an HTTP server inside your Actor for monitoring or serving content during execution.
- [Adaptive scraping with Scrapling](https://docs.apify.com/sdk/python/docs/guides/scrapling.md): Build an Apify Actor that scrapes web pages using the Scrapling adaptive web scraping library.
- [Building crawlers with Scrapy](https://docs.apify.com/sdk/python/docs/guides/scrapy.md): Convert Scrapy spiders into Apify Actors with platform storage and proxy integration.
- [Browser automation with Selenium](https://docs.apify.com/sdk/python/docs/guides/selenium.md): Build an Apify Actor that scrapes dynamic web pages using Selenium WebDriver.
- [Project management with uv](https://docs.apify.com/sdk/python/docs/guides/uv.md): Manage your Actor's Python version, dependencies, and virtual environment with the uv package and project manager.
- [Overview](https://docs.apify.com/sdk/python/docs/overview.md): The official library for creating Apify Actors in Python, providing tools for web scraping, automation, and data storage integration.
- [Quick start](https://docs.apify.com/sdk/python/docs/quick-start.md): Get started with the Apify SDK for Python by creating your first Actor and learning the basics.
- [Upgrading to v2](https://docs.apify.com/sdk/python/docs/upgrading/upgrading-to-v2.md): Breaking changes and migration guide from Apify SDK v1.x to v2.0.
- [Upgrading to v3](https://docs.apify.com/sdk/python/docs/upgrading/upgrading-to-v3.md): Breaking changes and migration guide from Apify SDK v2.x to v3.0.
- [Upgrading to v4](https://docs.apify.com/sdk/python/docs/upgrading/upgrading-to-v4.md): Breaking changes and migration guide from Apify SDK v3.x to v4.0.
- [apify](https://docs.apify.com/sdk/python/reference.md)
- [_FetchedPricingInfoDict](https://docs.apify.com/sdk/python/reference/class/_FetchedPricingInfoDict.md)
- [_RequestDetails](https://docs.apify.com/sdk/python/reference/class/_RequestDetails.md)
- [_RequestsFromUrlInput](https://docs.apify.com/sdk/python/reference/class/_RequestsFromUrlInput.md)
- [_SimpleUrlInput](https://docs.apify.com/sdk/python/reference/class/_SimpleUrlInput.md)
- [AbortingEvent](https://docs.apify.com/sdk/python/reference/class/AbortingEvent.md): An `aborting` event signalling the Actor run is being aborted.
- [Actor](https://docs.apify.com/sdk/python/reference/class/Actor.md): The core class for building Actors on the Apify platform.
- [ActorChargeEvent](https://docs.apify.com/sdk/python/reference/class/ActorChargeEvent.md): Definition of a single chargeable event in the pay-per-event pricing model.
- [ActorDatasetPushPipeline](https://docs.apify.com/sdk/python/reference/class/ActorDatasetPushPipeline.md): A Scrapy pipeline for pushing items to an Actor's default dataset.
- [ActorEnvVars](https://docs.apify.com/sdk/python/reference/class/ActorEnvVars.md): Environment variables with ACTOR_ prefix set by the Apify platform.
- [ActorLogFormatter](https://docs.apify.com/sdk/python/reference/class/ActorLogFormatter.md)
- [ActorPricingInfo](https://docs.apify.com/sdk/python/reference/class/ActorPricingInfo.md): Result of the `ChargingManager.get_pricing_info` method.
- [ActorStorages](https://docs.apify.com/sdk/python/reference/class/ActorStorages.md): Mapping of storage aliases to their IDs, grouped by storage type.
- [AddRequestsResponse](https://docs.apify.com/sdk/python/reference/class/AddRequestsResponse.md): Model for a response to add requests to a queue.
- [AliasResolver](https://docs.apify.com/sdk/python/reference/class/AliasResolver.md): Class for handling aliases.
- [ApifyApiError](https://docs.apify.com/sdk/python/reference/class/ApifyApiError.md): Error raised when the Apify API returns an error response.
- [ApifyCacheStorage](https://docs.apify.com/sdk/python/reference/class/ApifyCacheStorage.md): A Scrapy cache storage that uses the Apify `KeyValueStore` to store responses.
- [ApifyClientError](https://docs.apify.com/sdk/python/reference/class/ApifyClientError.md): Base class for all Apify API client errors.
- [ApifyDatasetClient](https://docs.apify.com/sdk/python/reference/class/ApifyDatasetClient.md): An Apify platform implementation of the dataset client.
- [ApifyEnvVars](https://docs.apify.com/sdk/python/reference/class/ApifyEnvVars.md): Environment variables with APIFY_ prefix set by the Apify platform.
- [ApifyEventManager](https://docs.apify.com/sdk/python/reference/class/ApifyEventManager.md): Event manager for the Apify platform.
- [ApifyFileSystemDatasetClient](https://docs.apify.com/sdk/python/reference/class/ApifyFileSystemDatasetClient.md): Apify-specific implementation of the `FileSystemDatasetClient`.
- [ApifyFileSystemKeyValueStoreClient](https://docs.apify.com/sdk/python/reference/class/ApifyFileSystemKeyValueStoreClient.md): Apify-specific implementation of the `FileSystemKeyValueStoreClient`.
- [ApifyFileSystemStorageClient](https://docs.apify.com/sdk/python/reference/class/ApifyFileSystemStorageClient.md): Apify-specific implementation of the file system storage client.
- [ApifyGracefulStopExtension](https://docs.apify.com/sdk/python/reference/class/ApifyGracefulStopExtension.md): A Scrapy extension that stops the crawl gracefully when the Actor run is being aborted.
- [ApifyHttpProxyMiddleware](https://docs.apify.com/sdk/python/reference/class/ApifyHttpProxyMiddleware.md): Apify HTTP proxy middleware for Scrapy.
- [ApifyKeyValueStoreClient](https://docs.apify.com/sdk/python/reference/class/ApifyKeyValueStoreClient.md): An Apify platform implementation of the key-value store client.
- [ApifyKeyValueStoreMetadata](https://docs.apify.com/sdk/python/reference/class/ApifyKeyValueStoreMetadata.md): Extended key-value store metadata model for Apify platform.
- [ApifyRequestList](https://docs.apify.com/sdk/python/reference/class/ApifyRequestList.md): A request list that can be constructed from the standard Apify `requestListSources` Actor input format.
- [ApifyRequestQueueClient](https://docs.apify.com/sdk/python/reference/class/ApifyRequestQueueClient.md): Request queue client for the Apify platform.
- [ApifyRequestQueueMetadata](https://docs.apify.com/sdk/python/reference/class/ApifyRequestQueueMetadata.md): Extended request queue metadata model for Apify platform.
- [ApifyRequestQueueSharedClient](https://docs.apify.com/sdk/python/reference/class/ApifyRequestQueueSharedClient.md): Internal request queue client implementation for multi-consumer scenarios on the Apify platform.
- [ApifyRequestQueueSingleClient](https://docs.apify.com/sdk/python/reference/class/ApifyRequestQueueSingleClient.md): Internal request queue client implementation for single-consumer scenarios on the Apify platform.
- [ApifyScheduler](https://docs.apify.com/sdk/python/reference/class/ApifyScheduler.md): A Scrapy scheduler that uses the Apify `RequestQueue` to manage requests.
- [ApifyStorageClient](https://docs.apify.com/sdk/python/reference/class/ApifyStorageClient.md): Apify platform implementation of the storage client.
- [AsyncThread](https://docs.apify.com/sdk/python/reference/class/AsyncThread.md): Run an asyncio event loop in a dedicated background thread.
- [CachedRequest](https://docs.apify.com/sdk/python/reference/class/CachedRequest.md): Pydantic model for cached request information.
- [ChargeResult](https://docs.apify.com/sdk/python/reference/class/ChargeResult.md): Result of the `ChargingManager.charge` method.
- [ChargingManager](https://docs.apify.com/sdk/python/reference/class/ChargingManager.md): Provides fine-grained access to pay-per-event functionality.
- [ChargingManagerImplementation](https://docs.apify.com/sdk/python/reference/class/ChargingManagerImplementation.md): Implementation of the `ChargingManager` Protocol - this is only meant to be instantiated internally.
- [ChargingStateItem](https://docs.apify.com/sdk/python/reference/class/ChargingStateItem.md)
- [Configuration](https://docs.apify.com/sdk/python/reference/class/Configuration.md): A class for specifying the configuration of an Actor.
- [ConflictError](https://docs.apify.com/sdk/python/reference/class/ConflictError.md): Raised when the Apify API returns an HTTP 409 Conflict response.
- [Dataset](https://docs.apify.com/sdk/python/reference/class/Dataset.md): Dataset is a storage for managing structured tabular data.
- [DatasetClientPpeMixin](https://docs.apify.com/sdk/python/reference/class/DatasetClientPpeMixin.md): A mixin for dataset clients to add support for PPE pricing model and tracking synthetic events.
- [DatasetItemsListPage](https://docs.apify.com/sdk/python/reference/class/DatasetItemsListPage.md): Model for a single page of dataset items returned from a collection list method.
- [DatasetMetadata](https://docs.apify.com/sdk/python/reference/class/DatasetMetadata.md): Model for a dataset metadata.
- [DeprecatedEvent](https://docs.apify.com/sdk/python/reference/class/DeprecatedEvent.md): A deprecated event kept for backward compatibility (e.g. `cpuInfo`).
- [EventAbortingData](https://docs.apify.com/sdk/python/reference/class/EventAbortingData.md): Data for the aborting event.
- [EventExitData](https://docs.apify.com/sdk/python/reference/class/EventExitData.md): Data for the exit event.
- [EventManager](https://docs.apify.com/sdk/python/reference/class/EventManager.md): Manage events and their listeners, enabling registration, emission, and execution control.
- [EventMigratingData](https://docs.apify.com/sdk/python/reference/class/EventMigratingData.md): Data for the migrating event.
- [EventPersistStateData](https://docs.apify.com/sdk/python/reference/class/EventPersistStateData.md): Data for the persist state event.
- [EventSystemInfoData](https://docs.apify.com/sdk/python/reference/class/EventSystemInfoData.md): Data for the system info event.
- [EventWithoutData](https://docs.apify.com/sdk/python/reference/class/EventWithoutData.md): A framework-level event that carries no payload (e.g. browser and page lifecycle events).
- [ExitEvent](https://docs.apify.com/sdk/python/reference/class/ExitEvent.md): An `exit` event signalling the Actor process is about to exit.
- [FileSystemStorageClient](https://docs.apify.com/sdk/python/reference/class/FileSystemStorageClient.md): File system implementation of the storage client.
- [FlatPricePerMonthActorPricingInfo](https://docs.apify.com/sdk/python/reference/class/FlatPricePerMonthActorPricingInfo.md): Pricing info for an Actor billed at a flat monthly price.
- [ForbiddenError](https://docs.apify.com/sdk/python/reference/class/ForbiddenError.md): Raised when the Apify API returns an HTTP 403 Forbidden response.
- [FreeActorPricingInfo](https://docs.apify.com/sdk/python/reference/class/FreeActorPricingInfo.md): Pricing info for an Actor offered free of charge.
- [IdempotentChargeItem](https://docs.apify.com/sdk/python/reference/class/IdempotentChargeItem.md)
- [InvalidRequestError](https://docs.apify.com/sdk/python/reference/class/InvalidRequestError.md): Raised when the Apify API returns an HTTP 400 Bad Request response.
- [InvalidResponseBodyError](https://docs.apify.com/sdk/python/reference/class/InvalidResponseBodyError.md): Error raised when a response body cannot be parsed.
- [KeyValueStore](https://docs.apify.com/sdk/python/reference/class/KeyValueStore.md): Key-value store is a storage for reading and writing data records with unique key identifiers.
- [KeyValueStoreMetadata](https://docs.apify.com/sdk/python/reference/class/KeyValueStoreMetadata.md): Model for a key-value store metadata.
- [KeyValueStoreRecord](https://docs.apify.com/sdk/python/reference/class/KeyValueStoreRecord.md): Model for a key-value store record.
- [KeyValueStoreRecordMetadata](https://docs.apify.com/sdk/python/reference/class/KeyValueStoreRecordMetadata.md): Model for a key-value store record metadata.
- [LocalEventManager](https://docs.apify.com/sdk/python/reference/class/LocalEventManager.md): Event manager for local environments.
- [MemoryStorageClient](https://docs.apify.com/sdk/python/reference/class/MemoryStorageClient.md): Memory implementation of the storage client.
- [MigratingEvent](https://docs.apify.com/sdk/python/reference/class/MigratingEvent.md): A `migrating` event signalling the Actor is about to be migrated to another host.
- [NotFoundError](https://docs.apify.com/sdk/python/reference/class/NotFoundError.md): Raised when the Apify API returns an HTTP 404 Not Found response.
- [PayPerEventActorPricingInfo](https://docs.apify.com/sdk/python/reference/class/PayPerEventActorPricingInfo.md): Pricing info for an Actor billed per charged event.
- [PersistStateEvent](https://docs.apify.com/sdk/python/reference/class/PersistStateEvent.md): A `persistState` event instructing the Actor to persist its state.
- [PricePerDatasetItemActorPricingInfo](https://docs.apify.com/sdk/python/reference/class/PricePerDatasetItemActorPricingInfo.md): Pricing info for an Actor billed per dataset item produced.
- [PricingInfoItem](https://docs.apify.com/sdk/python/reference/class/PricingInfoItem.md)
- [PricingPerEvent](https://docs.apify.com/sdk/python/reference/class/PricingPerEvent.md): Pay-per-event pricing details - the chargeable events and their prices.
- [ProcessedRequest](https://docs.apify.com/sdk/python/reference/class/ProcessedRequest.md): Represents a processed request.
- [ProxyConfiguration](https://docs.apify.com/sdk/python/reference/class/ProxyConfiguration.md): Configures a connection to a proxy server with the provided options.
- [ProxyInfo](https://docs.apify.com/sdk/python/reference/class/ProxyInfo.md): Provides information about a proxy connection that is used for requests.
- [RateLimitError](https://docs.apify.com/sdk/python/reference/class/RateLimitError.md): Raised when the Apify API returns an HTTP 429 Too Many Requests response.
- [ReentrantLock](https://docs.apify.com/sdk/python/reference/class/ReentrantLock.md): A reentrant lock implementation for asyncio using asyncio.Lock.
- [Request](https://docs.apify.com/sdk/python/reference/class/Request.md): Represents a request in the Crawlee framework, containing the necessary information for crawling operations.
- [RequestLoader](https://docs.apify.com/sdk/python/reference/class/RequestLoader.md): An abstract class defining the interface for classes that provide access to a read-only stream of requests.
- [RequestManager](https://docs.apify.com/sdk/python/reference/class/RequestManager.md): Base class that extends `RequestLoader` with the capability to enqueue new requests and reclaim failed ones.
- [RequestManagerTandem](https://docs.apify.com/sdk/python/reference/class/RequestManagerTandem.md): Implements a tandem behaviour for a pair of `RequestLoader` and `RequestManager`.
- [RequestQueue](https://docs.apify.com/sdk/python/reference/class/RequestQueue.md): Request queue is a storage for managing HTTP requests.
- [RequestQueueHead](https://docs.apify.com/sdk/python/reference/class/RequestQueueHead.md): Model for request queue head.
- [RequestQueueMetadata](https://docs.apify.com/sdk/python/reference/class/RequestQueueMetadata.md): Model for a request queue metadata.
- [ServerError](https://docs.apify.com/sdk/python/reference/class/ServerError.md): Raised when the Apify API returns an HTTP 5xx response.
- [SitemapRequestLoader](https://docs.apify.com/sdk/python/reference/class/SitemapRequestLoader.md): A request loader that reads URLs from sitemap(s).
- [SmartApifyStorageClient](https://docs.apify.com/sdk/python/reference/class/SmartApifyStorageClient.md): Storage client that automatically selects cloud or local storage client based on the environment.
- [Storage](https://docs.apify.com/sdk/python/reference/class/Storage.md): Base class for storages.
- [StorageClient](https://docs.apify.com/sdk/python/reference/class/StorageClient.md): Base class for storage clients.
- [StorageMetadata](https://docs.apify.com/sdk/python/reference/class/StorageMetadata.md): Represents the base model for storage metadata.
- [SystemInfoEvent](https://docs.apify.com/sdk/python/reference/class/SystemInfoEvent.md): A `systemInfo` event carrying the Actor's resource usage metrics.
- [SystemInfoEventData](https://docs.apify.com/sdk/python/reference/class/SystemInfoEventData.md): Resource usage metrics carried by a `systemInfo` event.
- [UnauthorizedError](https://docs.apify.com/sdk/python/reference/class/UnauthorizedError.md): Raised when the Apify API returns an HTTP 401 Unauthorized response.
- [UnknownEvent](https://docs.apify.com/sdk/python/reference/class/UnknownEvent.md): A fallback for any event whose name is not recognized by the SDK.
- [Webhook](https://docs.apify.com/sdk/python/reference/class/Webhook.md): An Apify webhook definition used by the Actor SDK.
- [Event](https://docs.apify.com/sdk/python/reference/enum/Event.md): Names of all possible events that can be emitted using an `EventManager`.
