VOOZH about

URL: https://pypi.org/project/apify-client/

โ‡ฑ apify-client ยท PyPI


Skip to main content

apify-client 3.0.3

pip install apify-client

Latest release

Released:

Apify API client for Python

Navigation

Unverified details

These details have not been verified by PyPI
Project links
Meta
  • License: Apache Software License (Apache License)
  • Author: Apify Technologies s.r.o.
  • Tags api , apify , automation , client , crawling , scraping
  • Requires: Python >=3.11

Project description

Apify API client for Python

The official Python client for the Apify REST API.

๐Ÿ‘ PyPI version
๐Ÿ‘ PyPI downloads
๐Ÿ‘ Python versions
๐Ÿ‘ Build status
๐Ÿ‘ Coverage
๐Ÿ‘ License
๐Ÿ‘ Chat on Discord

apify-client lets you talk to the Apify platform from Python โ€” run Actors, manage storages (datasets, key-value stores, request queues), schedule tasks, configure webhooks, and use everything else exposed by the Apify API. It ships both synchronous and asynchronous clients, fully typed responses, automatic retries with exponential backoff, tiered timeouts, pagination helpers, streaming, and a pluggable HTTP layer.

If you want to build Apify Actors in Python rather than consume the API, use the Apify SDK for Python instead โ€” it bundles this client and adds Actor-side primitives.

Table of contents

Installation

apify-client requires Python 3.11 or higher. It is published on PyPI and can be installed for example with pip:

pipinstallapify-client

or with uv:

uvaddapify-client

or any other Python package manager that consumes PyPI.

Quick start

You'll need an Apify API token โ€” find yours in the Integrations section of Apify Console. Pass it to the client and you're ready to go.

Synchronous client

fromapify_clientimport ApifyClient

client = ApifyClient('MY-APIFY-TOKEN')

# Start an Actor and wait for it to finish.
run = client.actor('apify/hello-world').call(
 run_input={'message': 'Hello, Apify!'},
)

# Iterate items from the run's default dataset.
for item in client.dataset(run.default_dataset_id).iterate_items():
 print(item)

Asynchronous client

importasyncio

fromapify_clientimport ApifyClientAsync


async defmain() -> None:
 client = ApifyClientAsync('MY-APIFY-TOKEN')

 run = await client.actor('apify/hello-world').call(
 run_input={'message': 'Hello, Apify!'},
 )

 # Iterate items from the run's default dataset.
 async for item in client.dataset(run.default_dataset_id).iterate_items():
 print(item)


asyncio.run(main())

Keep your token secret. It authorizes requests on your behalf and can incur usage costs. Never commit it to source control or expose it to client-side code.

For a guided walkthrough โ€” authenticating, running an Actor, and reading its results โ€” see the Quick start guide.

Features

  • Synchronous and asynchronous clients โ€” pick ApifyClient or ApifyClientAsync to match your codebase; both expose the same API (Asyncio support).
  • Fully typed responses โ€” every method returns a Pydantic model generated from the Apify OpenAPI spec, with IDE autocomplete and runtime validation (Typed models).
  • Automatic retries โ€” exponential backoff for network errors, HTTP 429, and 5xx responses, configurable per client (Retries).
  • Tiered timeouts โ€” short / medium / long tiers picked per endpoint, overridable per call (Timeouts).
  • Pagination and streaming โ€” iterate datasets, key-value store keys, or live logs without manual paging or buffering (Pagination, Streaming).
  • Convenience methods โ€” call(), wait_for_finish(), nested resource access, and other shortcuts that hide platform quirks (Convenience methods).
  • Pluggable HTTP layer โ€” swap the default Impit-based HTTP client for httpx, requests, aiohttp, or any custom implementation (Custom HTTP clients).
  • Structured errors โ€” every API error surfaces as an ApifyApiError with HTTP-specific subclasses for precise handling (Error handling).
  • Debug logging โ€” opt-in structured logging on the apify_client logger captures request URLs, status codes, retry attempts, and more (Logging).

Usage examples

The client mirrors the platform's resource model. Each entry point returns either a single-resource client for an individual item or a collection client for listing and creating items (Single and collection clients).

List Actors and create one

actors = client.actors()
print(actors.list(limit=10).items)

new_actor = actors.create(name='my-actor')

Stream live logs while a run is in progress

run = client.actor('apify/web-scraper').start(run_input={...})

with client.run(run.id).log().stream() as log_stream:
 for chunk in log_stream.iter_bytes():
 print(chunk.decode(), end='')

Read and write key-value store records

store = client.key_value_store('STORE-ID')
store.set_record('greeting', {'message': 'Hello!'})
record = store.get_record('greeting')

Iterate dataset items with automatic pagination

for item in client.dataset('DATASET-ID').iterate_items(fields='title,url'):
 process(item)

Tune retries and timeouts

fromdatetimeimport timedelta

fromapify_clientimport ApifyClient

client = ApifyClient(
 token='MY-APIFY-TOKEN',
 max_retries=8,
 min_delay_between_retries=timedelta(milliseconds=500),
 timeout_long=timedelta(minutes=10),
)

For end-to-end recipes โ€” passing input, managing tasks for reusable input, retrieving and merging Actor data, integrating with Pandas, plugging in a custom HTTP client โ€” see the Guides.

Documentation

The full documentation lives at docs.apify.com/api/client/python.

Section What you'll find
Introduction Overview, prerequisites, and a tour of the client.
Quick start Authenticate, run an Actor, and fetch its results step by step.
Concepts Asyncio, single vs. collection clients, nested clients, error handling, retries, logging, convenience methods, pagination, streaming, custom HTTP clients, timeouts.
Guides Pass input to an Actor, manage tasks for reusable input, retrieve Actor data, integrate with data libraries (e.g. Pandas), use HTTPX as the HTTP client.
Upgrading Migrating between major versions.
API reference Generated reference for every class, method, and model.
Changelog Release history and breaking changes.

Related projects

Support and community

  • Discord โ€” chat with the team and other users on the Apify Discord server.
  • GitHub issues โ€” report a bug or request a feature in the repository's issue tracker.

Contributing

Bug reports, fixes, and improvements are welcome! See CONTRIBUTING.md for the development setup, coding standards, testing, and the release process. The repo uses uv for project management and Poe the Poet as a task runner; the typical loop is:

uvrunpoeinstall-dev# install dev deps and git hooks
uvrunpoecheck-code# lint, type-check, unit tests, docstring check

License

Released under the Apache License 2.0.

Project details

Unverified details

These details have not been verified by PyPI
Project links
Meta
  • License: Apache Software License (Apache License)
  • Author: Apify Technologies s.r.o.
  • Tags api , apify , automation , client , crawling , scraping
  • Requires: Python >=3.11

Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

apify_client-3.0.3.tar.gz (122.9 kB view details)

Uploaded Source

Built Distribution

Filter files by name, interpreter, ABI, and platform.

If you're not sure about the file name format, learn more about wheel file names.

Copy a direct link to the current filters

apify_client-3.0.3-py3-none-any.whl (141.7 kB view details)

Uploaded Python 3

File details

Details for the file apify_client-3.0.3.tar.gz.

File metadata

  • Download URL: apify_client-3.0.3.tar.gz
  • Upload date:
  • Size: 122.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for apify_client-3.0.3.tar.gz
Algorithm Hash digest
SHA256 22f8cf8cd613b1a31c164cbcca3c17938900653fe2bb0be5da1337d59a6b1915
MD5 673ca93e1c401c21add78ebd839799ef
BLAKE2b-256 ca8dbdaf4a143837fa82df5438bf85fab0f1ee6ded46ba63c306b2a8ea11544c

See more details on using hashes here.

Provenance

The following attestation bundles were made for apify_client-3.0.3.tar.gz:

Publisher: manual_release_stable.yaml on apify/apify-client-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file apify_client-3.0.3-py3-none-any.whl.

File metadata

  • Download URL: apify_client-3.0.3-py3-none-any.whl
  • Upload date:
  • Size: 141.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for apify_client-3.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f930d69b18a7df6941c6034843762bf8efbd0a1df4a520c55a79e55487cb4d5c
MD5 8ce09a782593257598e470e211ad797a
BLAKE2b-256 09a860087cfdbbc812294472ec7f0974d70b725cc41dc2723a4a81d6ce5142ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for apify_client-3.0.3-py3-none-any.whl:

Publisher: manual_release_stable.yaml on apify/apify-client-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

๐Ÿ‘ Image
AWS Cloud computing and Security Sponsor ๐Ÿ‘ Image
Datadog Monitoring ๐Ÿ‘ Image
Depot Continuous Integration ๐Ÿ‘ Image
Fastly CDN ๐Ÿ‘ Image
Google Download Analytics ๐Ÿ‘ Image
Pingdom Monitoring ๐Ÿ‘ Image
Sentry Error logging ๐Ÿ‘ Image
StatusPage Status page