apify


Nameapify JSON
Version 1.7.0 PyPI version JSON
download
home_page
SummaryApify SDK for Python
upload_time2024-03-12 16:24:15
maintainer
docs_urlNone
author
requires_python>=3.8
licenseApache Software License
keywords apify sdk actor scraping automation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Apify SDK for Python

The Apify SDK for Python is the official library to create [Apify Actors](https://docs.apify.com/platform/actors)
in Python. It provides useful features like Actor lifecycle management, local storage emulation, and Actor
event handling.

If you just need to access the [Apify API](https://docs.apify.com/api/v2) from your Python applications,
check out the [Apify Client for Python](https://docs.apify.com/api/client/python) instead.

## Installation

The Apify SDK for Python is available on PyPI as the `apify` package.
For default installation, using Pip, run the following:

```bash
pip install apify
```

For users interested in integrating Apify with Scrapy, we provide a package extra called `scrapy`.
To install Apify with the `scrapy` extra, use the following command:

```bash
pip install apify[scrapy]
```

## Documentation

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

## Example

```python
from apify import Actor
from bs4 import BeautifulSoup
from httpx import AsyncClient

async def main() -> None:
    async with Actor:
        # Read the input parameters from the Actor input
        actor_input = await Actor.get_input()
        # Fetch the HTTP response from the specified URL
        async with AsyncClient() as client:
            response = await client.get(actor_input['url'])
        # Process the HTML content
        soup = BeautifulSoup(response.content, 'html.parser')
        # Push the extracted data
        await Actor.push_data({
            'url': actor_input['url'],
            'title': soup.title.string,
        })
```

## What are Actors?

Actors are serverless cloud programs that can do almost anything a human can do in a web browser.
They can do anything from small tasks such as filling in forms or unsubscribing from online services,
all the way up to scraping and processing vast numbers of web pages.

They can be run either locally, or on the [Apify platform](https://docs.apify.com/platform/),
where you can run them at scale, monitor them, schedule them, or publish and monetize them.

If you're new to Apify, learn [what is Apify](https://docs.apify.com/platform/about)
in the Apify platform documentation.

## Creating Actors

To create and run Actors through Apify Console,
see the [Console documentation](https://docs.apify.com/academy/getting-started/creating-actors#choose-your-template).

To create and run Python Actors locally, check the documentation for
[how to create and run Python Actors locally](https://docs.apify.com/sdk/python/docs/overview/running-locally).

## Guides

To see how you can use the Apify SDK with other popular libraries used for web scraping,
check out our guides for using
[Requests and HTTPX](https://docs.apify.com/sdk/python/docs/guides/requests-and-httpx),
[Beautiful Soup](https://docs.apify.com/sdk/python/docs/guides/beautiful-soup),
[Playwright](https://docs.apify.com/sdk/python/docs/guides/playwright),
[Selenium](https://docs.apify.com/sdk/python/docs/guides/selenium),
or [Scrapy](https://docs.apify.com/sdk/python/docs/guides/scrapy).

## Usage concepts

To learn more about the features of the Apify SDK and how to use them,
check out the Usage Concepts section in the sidebar,
particularly the guides for the [Actor lifecycle](https://docs.apify.com/sdk/python/docs/concepts/actor-lifecycle),
[working with storages](https://docs.apify.com/sdk/python/docs/concepts/storages),
[handling Actor events](https://docs.apify.com/sdk/python/docs/concepts/actor-events)
or [how to use proxies](https://docs.apify.com/sdk/python/docs/concepts/proxy-management).

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "apify",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "apify,sdk,actor,scraping,automation",
    "author": "",
    "author_email": "\"Apify Technologies s.r.o.\" <support@apify.com>",
    "download_url": "https://files.pythonhosted.org/packages/ff/2c/cc82b33ff3be30bf2371cb8bfb849b1f30b94ee5390915649a52e2d028ac/apify-1.7.0.tar.gz",
    "platform": null,
    "description": "# Apify SDK for Python\n\nThe Apify SDK for Python is the official library to create [Apify Actors](https://docs.apify.com/platform/actors)\nin Python. It provides useful features like Actor lifecycle management, local storage emulation, and Actor\nevent handling.\n\nIf you just need to access the [Apify API](https://docs.apify.com/api/v2) from your Python applications,\ncheck out the [Apify Client for Python](https://docs.apify.com/api/client/python) instead.\n\n## Installation\n\nThe Apify SDK for Python is available on PyPI as the `apify` package.\nFor default installation, using Pip, run the following:\n\n```bash\npip install apify\n```\n\nFor users interested in integrating Apify with Scrapy, we provide a package extra called `scrapy`.\nTo install Apify with the `scrapy` extra, use the following command:\n\n```bash\npip install apify[scrapy]\n```\n\n## Documentation\n\nFor usage instructions, check the documentation on [Apify Docs](https://docs.apify.com/sdk/python/).\n\n## Example\n\n```python\nfrom apify import Actor\nfrom bs4 import BeautifulSoup\nfrom httpx import AsyncClient\n\nasync def main() -> None:\n    async with Actor:\n        # Read the input parameters from the Actor input\n        actor_input = await Actor.get_input()\n        # Fetch the HTTP response from the specified URL\n        async with AsyncClient() as client:\n            response = await client.get(actor_input['url'])\n        # Process the HTML content\n        soup = BeautifulSoup(response.content, 'html.parser')\n        # Push the extracted data\n        await Actor.push_data({\n            'url': actor_input['url'],\n            'title': soup.title.string,\n        })\n```\n\n## What are Actors?\n\nActors are serverless cloud programs that can do almost anything a human can do in a web browser.\nThey can do anything from small tasks such as filling in forms or unsubscribing from online services,\nall the way up to scraping and processing vast numbers of web pages.\n\nThey can be run either locally, or on the [Apify platform](https://docs.apify.com/platform/),\nwhere you can run them at scale, monitor them, schedule them, or publish and monetize them.\n\nIf you're new to Apify, learn [what is Apify](https://docs.apify.com/platform/about)\nin the Apify platform documentation.\n\n## Creating Actors\n\nTo create and run Actors through Apify Console,\nsee the [Console documentation](https://docs.apify.com/academy/getting-started/creating-actors#choose-your-template).\n\nTo create and run Python Actors locally, check the documentation for\n[how to create and run Python Actors locally](https://docs.apify.com/sdk/python/docs/overview/running-locally).\n\n## Guides\n\nTo see how you can use the Apify SDK with other popular libraries used for web scraping,\ncheck out our guides for using\n[Requests and HTTPX](https://docs.apify.com/sdk/python/docs/guides/requests-and-httpx),\n[Beautiful Soup](https://docs.apify.com/sdk/python/docs/guides/beautiful-soup),\n[Playwright](https://docs.apify.com/sdk/python/docs/guides/playwright),\n[Selenium](https://docs.apify.com/sdk/python/docs/guides/selenium),\nor [Scrapy](https://docs.apify.com/sdk/python/docs/guides/scrapy).\n\n## Usage concepts\n\nTo learn more about the features of the Apify SDK and how to use them,\ncheck out the Usage Concepts section in the sidebar,\nparticularly the guides for the [Actor lifecycle](https://docs.apify.com/sdk/python/docs/concepts/actor-lifecycle),\n[working with storages](https://docs.apify.com/sdk/python/docs/concepts/storages),\n[handling Actor events](https://docs.apify.com/sdk/python/docs/concepts/actor-events)\nor [how to use proxies](https://docs.apify.com/sdk/python/docs/concepts/proxy-management).\n",
    "bugtrack_url": null,
    "license": "Apache Software License",
    "summary": "Apify SDK for Python",
    "version": "1.7.0",
    "project_urls": {
        "Apify Homepage": "https://apify.com",
        "Changelog": "https://github.com/apify/apify-sdk-python/blob/master/CHANGELOG.md",
        "Documentation": "https://docs.apify.com/sdk/python/",
        "Homepage": "https://docs.apify.com/sdk/python/",
        "Issue tracker": "https://github.com/apify/apify-sdk-python/issues",
        "Source": "https://github.com/apify/apify-sdk-python"
    },
    "split_keywords": [
        "apify",
        "sdk",
        "actor",
        "scraping",
        "automation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "65e27e067711be43df479309d8c63c2d8ce8d17f437975b9835cdc51da751bfb",
                "md5": "8e33053b26d520d8c41269903a9e2e34",
                "sha256": "1002166d17d89c5f2b7fd76a8860f5d2348fabb309947beff8b02a131b0365e0"
            },
            "downloads": -1,
            "filename": "apify-1.7.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8e33053b26d520d8c41269903a9e2e34",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 90642,
            "upload_time": "2024-03-12T16:24:13",
            "upload_time_iso_8601": "2024-03-12T16:24:13.500603Z",
            "url": "https://files.pythonhosted.org/packages/65/e2/7e067711be43df479309d8c63c2d8ce8d17f437975b9835cdc51da751bfb/apify-1.7.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ff2ccc82b33ff3be30bf2371cb8bfb849b1f30b94ee5390915649a52e2d028ac",
                "md5": "e9a39284be0af32734d368dd960b3dbc",
                "sha256": "a27fa98c85c81648320fc900dc636da29f94d2f9bb9095e50a83a41252a4e3a2"
            },
            "downloads": -1,
            "filename": "apify-1.7.0.tar.gz",
            "has_sig": false,
            "md5_digest": "e9a39284be0af32734d368dd960b3dbc",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 74079,
            "upload_time": "2024-03-12T16:24:15",
            "upload_time_iso_8601": "2024-03-12T16:24:15.875262Z",
            "url": "https://files.pythonhosted.org/packages/ff/2c/cc82b33ff3be30bf2371cb8bfb849b1f30b94ee5390915649a52e2d028ac/apify-1.7.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-12 16:24:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "apify",
    "github_project": "apify-sdk-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "apify"
}
        
Elapsed time: 0.21983s