zyte-api


Namezyte-api JSON
Version 0.8.1 PyPI version JSON
download
home_pagehttps://github.com/zytedata/python-zyte-api
SummaryPython interface to Zyte API
upload_time2025-10-06 10:31:55
maintainerNone
docs_urlNone
authorZyte Group Ltd
requires_pythonNone
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ===============
python-zyte-api
===============

.. image:: https://img.shields.io/pypi/v/zyte-api.svg
   :target: https://pypi.python.org/pypi/zyte-api
   :alt: PyPI Version

.. image:: https://img.shields.io/pypi/pyversions/zyte-api.svg
   :target: https://pypi.python.org/pypi/zyte-api
   :alt: Supported Python Versions

.. image:: https://github.com/zytedata/python-zyte-api/actions/workflows/test.yml/badge.svg
   :target: https://github.com/zytedata/python-zyte-api/actions/workflows/test.yml
   :alt: Build Status

.. image:: https://codecov.io/github/zytedata/zyte-api/coverage.svg?branch=master
   :target: https://codecov.io/gh/zytedata/zyte-api
   :alt: Coverage report

.. description-start

Command-line client and Python client library for `Zyte API`_.

.. _Zyte API: https://docs.zyte.com/zyte-api/get-started.html

.. description-end

Installation
============

.. install-start

.. code-block:: shell

    pip install zyte-api

Or, to use x402_:

.. _x402: https://www.x402.org/

.. code-block:: shell

    pip install zyte-api[x402]

.. note:: Python 3.9+ is required; Python 3.10+ if using x402.

.. install-end

Basic usage
===========

.. basic-key-start

Set your API key
----------------

.. key-get-start

After you `sign up for a Zyte API account
<https://app.zyte.com/account/signup/zyteapi>`_, copy `your API key
<https://app.zyte.com/o/zyte-api/api-access>`_.

.. key-get-end
.. basic-key-end

.. basic-start


Use the command-line client
---------------------------

Then you can use the zyte-api command-line client to send Zyte API requests.
First create a text file with a list of URLs:

.. code-block:: none

    https://books.toscrape.com
    https://quotes.toscrape.com

And then call ``zyte-api`` from your shell:

.. code-block:: shell

    zyte-api url-list.txt --api-key YOUR_API_KEY --output results.jsonl


Use the Python sync API
-----------------------

For very basic Python scripts, use the sync API:

.. code-block:: python

    from zyte_api import ZyteAPI

    client = ZyteAPI(api_key="YOUR_API_KEY")
    response = client.get({"url": "https://toscrape.com", "httpResponseBody": True})


Use the Python async API
------------------------

For asyncio code, use the async API:

.. code-block:: python

    import asyncio

    from zyte_api import AsyncZyteAPI


    async def main():
        client = AsyncZyteAPI(api_key="YOUR_API_KEY")
        response = await client.get(
            {"url": "https://toscrape.com", "httpResponseBody": True}
        )


    asyncio.run(main())

.. basic-end

Read the `documentation <https://python-zyte-api.readthedocs.io>`_  for more
information.

* Documentation: https://python-zyte-api.readthedocs.io
* Source code: https://github.com/zytedata/python-zyte-api
* Issue tracker: https://github.com/zytedata/python-zyte-api/issues

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/zytedata/python-zyte-api",
    "name": "zyte-api",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Zyte Group Ltd",
    "author_email": "opensource@zyte.com",
    "download_url": "https://files.pythonhosted.org/packages/28/0e/8e8b07fa2b97775a00ffd4f65e1903089fce3a15848722378efd4fce16cd/zyte_api-0.8.1.tar.gz",
    "platform": null,
    "description": "===============\npython-zyte-api\n===============\n\n.. image:: https://img.shields.io/pypi/v/zyte-api.svg\n   :target: https://pypi.python.org/pypi/zyte-api\n   :alt: PyPI Version\n\n.. image:: https://img.shields.io/pypi/pyversions/zyte-api.svg\n   :target: https://pypi.python.org/pypi/zyte-api\n   :alt: Supported Python Versions\n\n.. image:: https://github.com/zytedata/python-zyte-api/actions/workflows/test.yml/badge.svg\n   :target: https://github.com/zytedata/python-zyte-api/actions/workflows/test.yml\n   :alt: Build Status\n\n.. image:: https://codecov.io/github/zytedata/zyte-api/coverage.svg?branch=master\n   :target: https://codecov.io/gh/zytedata/zyte-api\n   :alt: Coverage report\n\n.. description-start\n\nCommand-line client and Python client library for `Zyte API`_.\n\n.. _Zyte API: https://docs.zyte.com/zyte-api/get-started.html\n\n.. description-end\n\nInstallation\n============\n\n.. install-start\n\n.. code-block:: shell\n\n    pip install zyte-api\n\nOr, to use x402_:\n\n.. _x402: https://www.x402.org/\n\n.. code-block:: shell\n\n    pip install zyte-api[x402]\n\n.. note:: Python 3.9+ is required; Python 3.10+ if using x402.\n\n.. install-end\n\nBasic usage\n===========\n\n.. basic-key-start\n\nSet your API key\n----------------\n\n.. key-get-start\n\nAfter you `sign up for a Zyte API account\n<https://app.zyte.com/account/signup/zyteapi>`_, copy `your API key\n<https://app.zyte.com/o/zyte-api/api-access>`_.\n\n.. key-get-end\n.. basic-key-end\n\n.. basic-start\n\n\nUse the command-line client\n---------------------------\n\nThen you can use the zyte-api command-line client to send Zyte API requests.\nFirst create a text file with a list of URLs:\n\n.. code-block:: none\n\n    https://books.toscrape.com\n    https://quotes.toscrape.com\n\nAnd then call ``zyte-api`` from your shell:\n\n.. code-block:: shell\n\n    zyte-api url-list.txt --api-key YOUR_API_KEY --output results.jsonl\n\n\nUse the Python sync API\n-----------------------\n\nFor very basic Python scripts, use the sync API:\n\n.. code-block:: python\n\n    from zyte_api import ZyteAPI\n\n    client = ZyteAPI(api_key=\"YOUR_API_KEY\")\n    response = client.get({\"url\": \"https://toscrape.com\", \"httpResponseBody\": True})\n\n\nUse the Python async API\n------------------------\n\nFor asyncio code, use the async API:\n\n.. code-block:: python\n\n    import asyncio\n\n    from zyte_api import AsyncZyteAPI\n\n\n    async def main():\n        client = AsyncZyteAPI(api_key=\"YOUR_API_KEY\")\n        response = await client.get(\n            {\"url\": \"https://toscrape.com\", \"httpResponseBody\": True}\n        )\n\n\n    asyncio.run(main())\n\n.. basic-end\n\nRead the `documentation <https://python-zyte-api.readthedocs.io>`_  for more\ninformation.\n\n* Documentation: https://python-zyte-api.readthedocs.io\n* Source code: https://github.com/zytedata/python-zyte-api\n* Issue tracker: https://github.com/zytedata/python-zyte-api/issues\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Python interface to Zyte API",
    "version": "0.8.1",
    "project_urls": {
        "Homepage": "https://github.com/zytedata/python-zyte-api"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "cacfc20e05c0e5f041f3b45201575a90572e275761d86a9b9c225067b38128fb",
                "md5": "5323fff5808ed88e01924daa8fb313c0",
                "sha256": "59565fae3898ffbd1962f260b32e9de957900d89bb8c16ddf1578c22d4fecbb7"
            },
            "downloads": -1,
            "filename": "zyte_api-0.8.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5323fff5808ed88e01924daa8fb313c0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 25185,
            "upload_time": "2025-10-06T10:31:54",
            "upload_time_iso_8601": "2025-10-06T10:31:54.158043Z",
            "url": "https://files.pythonhosted.org/packages/ca/cf/c20e05c0e5f041f3b45201575a90572e275761d86a9b9c225067b38128fb/zyte_api-0.8.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "280e8e8b07fa2b97775a00ffd4f65e1903089fce3a15848722378efd4fce16cd",
                "md5": "446474a585f67db62d5d1d2f02bae3b2",
                "sha256": "38d78e11e528c8b3f86c786f3ec88b1bab9dd8365ed2bcfc54bb41113963c31e"
            },
            "downloads": -1,
            "filename": "zyte_api-0.8.1.tar.gz",
            "has_sig": false,
            "md5_digest": "446474a585f67db62d5d1d2f02bae3b2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 37650,
            "upload_time": "2025-10-06T10:31:55",
            "upload_time_iso_8601": "2025-10-06T10:31:55.283514Z",
            "url": "https://files.pythonhosted.org/packages/28/0e/8e8b07fa2b97775a00ffd4f65e1903089fce3a15848722378efd4fce16cd/zyte_api-0.8.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-06 10:31:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zytedata",
    "github_project": "python-zyte-api",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "zyte-api"
}
        
Elapsed time: 4.62435s