apify-client


Nameapify-client JSON
Version 1.6.4 PyPI version JSON
download
home_page
SummaryApify API client for Python
upload_time2024-02-27 10:26:56
maintainer
docs_urlNone
author
requires_python>=3.8
licenseApache Software License
keywords apify api client scraping automation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Apify API client for Python

The Apify API Client for Python is the official library to access the [Apify API](https://docs.apify.com/api/v2) from your Python applications.
It provides useful features like automatic retries and convenience functions to improve your experience with the Apify API.

If you want to develop Apify Actors in Python,
check out the [Apify SDK for Python](https://docs.apify.com/sdk/python) instead.

## Installation

Requires Python 3.8+

You can install the package from its [PyPI listing](https://pypi.org/project/apify-client).
To do that, simply run `pip install apify-client` in your terminal.

## Usage

For usage instructions, check the documentation on [Apify Docs](https://docs.apify.com/api/client/python/).

## Quick Start

```python
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
```

## Features

Besides greatly simplifying the process of querying the Apify API, the client provides other useful features.

### Automatic parsing and error handling

Based on the endpoint, the client automatically extracts the relevant data and returns it in the
expected format. Date strings are automatically converted to `datetime.datetime` objects. For exceptions,
we throw an `ApifyApiError`, which wraps the plain JSON errors returned by API and enriches
them with other context for easier debugging.

### Retries with exponential backoff

Network communication sometimes fails. The client will automatically retry requests that
failed due to a network error, an internal error of the Apify API (HTTP 500+) or rate limit error (HTTP 429).
By default, it will retry up to 8 times. First retry will be attempted after ~500ms, second after ~1000ms
and so on. You can configure those parameters using the `max_retries` and `min_delay_between_retries_millis`
options of the `ApifyClient` constructor.

### Support for asynchronous usage

Starting with version 1.0.0, the package offers an asynchronous version of the client, [`ApifyClientAsync`](https://docs.apify.com/api/client/python),
which allows you to work with the Apify API in an asynchronous way, using the standard `async`/`await` syntax.

### Convenience functions and options

Some actions can't be performed by the API itself, such as indefinite waiting for an actor run to finish
(because of network timeouts). The client provides convenient `call()` and `wait_for_finish()` functions that do that.
Key-value store records can be retrieved as objects, buffers or streams via the respective options, dataset items
can be fetched as individual objects or serialized data and we plan to add better stream support and async iterators.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "apify-client",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "apify,api,client,scraping,automation",
    "author": "",
    "author_email": "\"Apify Technologies s.r.o.\" <support@apify.com>",
    "download_url": "https://files.pythonhosted.org/packages/d4/58/83d54aace9ae98981df5aaf455d77dff6882fc5261f9ee5db7d5b35bd95d/apify_client-1.6.4.tar.gz",
    "platform": null,
    "description": "# Apify API client for Python\n\nThe Apify API Client for Python is the official library to access the [Apify API](https://docs.apify.com/api/v2) from your Python applications.\nIt provides useful features like automatic retries and convenience functions to improve your experience with the Apify API.\n\nIf you want to develop Apify Actors in Python,\ncheck out the [Apify SDK for Python](https://docs.apify.com/sdk/python) instead.\n\n## Installation\n\nRequires Python 3.8+\n\nYou can install the package from its [PyPI listing](https://pypi.org/project/apify-client).\nTo do that, simply run `pip install apify-client` in your terminal.\n\n## Usage\n\nFor usage instructions, check the documentation on [Apify Docs](https://docs.apify.com/api/client/python/).\n\n## Quick Start\n\n```python\nfrom apify_client import ApifyClient\n\napify_client = ApifyClient('MY-APIFY-TOKEN')\n\n# Start an actor and wait for it to finish\nactor_call = apify_client.actor('john-doe/my-cool-actor').call()\n\n# Fetch results from the actor's default dataset\ndataset_items = apify_client.dataset(actor_call['defaultDatasetId']).list_items().items\n```\n\n## Features\n\nBesides greatly simplifying the process of querying the Apify API, the client provides other useful features.\n\n### Automatic parsing and error handling\n\nBased on the endpoint, the client automatically extracts the relevant data and returns it in the\nexpected format. Date strings are automatically converted to `datetime.datetime` objects. For exceptions,\nwe throw an `ApifyApiError`, which wraps the plain JSON errors returned by API and enriches\nthem with other context for easier debugging.\n\n### Retries with exponential backoff\n\nNetwork communication sometimes fails. The client will automatically retry requests that\nfailed due to a network error, an internal error of the Apify API (HTTP 500+) or rate limit error (HTTP 429).\nBy default, it will retry up to 8 times. First retry will be attempted after ~500ms, second after ~1000ms\nand so on. You can configure those parameters using the `max_retries` and `min_delay_between_retries_millis`\noptions of the `ApifyClient` constructor.\n\n### Support for asynchronous usage\n\nStarting with version 1.0.0, the package offers an asynchronous version of the client, [`ApifyClientAsync`](https://docs.apify.com/api/client/python),\nwhich allows you to work with the Apify API in an asynchronous way, using the standard `async`/`await` syntax.\n\n### Convenience functions and options\n\nSome actions can't be performed by the API itself, such as indefinite waiting for an actor run to finish\n(because of network timeouts). The client provides convenient `call()` and `wait_for_finish()` functions that do that.\nKey-value store records can be retrieved as objects, buffers or streams via the respective options, dataset items\ncan be fetched as individual objects or serialized data and we plan to add better stream support and async iterators.\n",
    "bugtrack_url": null,
    "license": "Apache Software License",
    "summary": "Apify API client for Python",
    "version": "1.6.4",
    "project_urls": {
        "Apify Homepage": "https://apify.com",
        "Changelog": "https://github.com/apify/apify-client-python/blob/master/CHANGELOG.md",
        "Documentation": "https://docs.apify.com/api/client/python/",
        "Homepage": "https://docs.apify.com/api/client/python/",
        "Issue tracker": "https://github.com/apify/apify-client-python/issues",
        "Source": "https://github.com/apify/apify-client-python"
    },
    "split_keywords": [
        "apify",
        "api",
        "client",
        "scraping",
        "automation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1bd997c1f645a5a2238dc3bef8b630e55c4db6f97df13d3284834b3c42cf35a4",
                "md5": "6a9683de5674344a2c98417187827c8e",
                "sha256": "9846202fadbbcfff2019e817abdd00fb336d9d936c45c8abc338e35ab82d2977"
            },
            "downloads": -1,
            "filename": "apify_client-1.6.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6a9683de5674344a2c98417187827c8e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 70566,
            "upload_time": "2024-02-27T10:26:54",
            "upload_time_iso_8601": "2024-02-27T10:26:54.206738Z",
            "url": "https://files.pythonhosted.org/packages/1b/d9/97c1f645a5a2238dc3bef8b630e55c4db6f97df13d3284834b3c42cf35a4/apify_client-1.6.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d45883d54aace9ae98981df5aaf455d77dff6882fc5261f9ee5db7d5b35bd95d",
                "md5": "78e7fa8cfe20c10d3d29ce36333362fe",
                "sha256": "b7b6b67a9631e86e829b42079e2864fec46a5be6fd0b5ccde941453006f494bb"
            },
            "downloads": -1,
            "filename": "apify_client-1.6.4.tar.gz",
            "has_sig": false,
            "md5_digest": "78e7fa8cfe20c10d3d29ce36333362fe",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 46705,
            "upload_time": "2024-02-27T10:26:56",
            "upload_time_iso_8601": "2024-02-27T10:26:56.555975Z",
            "url": "https://files.pythonhosted.org/packages/d4/58/83d54aace9ae98981df5aaf455d77dff6882fc5261f9ee5db7d5b35bd95d/apify_client-1.6.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-27 10:26:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "apify",
    "github_project": "apify-client-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "apify-client"
}
        
Elapsed time: 0.19579s