Overview
The Apify client for Python (apify_client) is the official library to access the Apify REST API from your Python applications. It provides useful features like automatic retries and convenience functions that improve the experience of using the Apify API.
Prerequisites
apify-client requires Python 3.7 or higher. Python is available for download on the official website. Check your current Python version by running:
python --version
Installation
The Apify client is available as the apify-client package on PyPI.
pip install apify-client
Quick example
from apify_client import ApifyClient
apify_client = ApifyClient('MY-APIFY-TOKEN')
# Start an actor and wait for it to finish
actor_call = apify_client.actor('john-doe/my-cool-actor').call()
# Fetch results from the actor's default dataset
dataset_items = apify_client.dataset(actor_call['defaultDatasetId']).list_items().items
You can find your API token in the Integrations section of Apify Console. See the Quick start guide for more details.