===============
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
.. note:: Python 3.9+ is required.
.. install-end
Basic usage
===========
.. basic-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
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/51/02/9f87a2af628f81b665b340dbd1fe4bb2702bf9cf04e493641bfa6833aa5d/zyte_api-0.7.0.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\n.. note:: Python 3.9+ is required.\n\n.. install-end\n\nBasic usage\n===========\n\n.. basic-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\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.7.0",
"project_urls": {
"Homepage": "https://github.com/zytedata/python-zyte-api"
},
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "2348b2739961079a266353f8c00e0de3a5b1b0bed4da8f094884941df84a9aee",
"md5": "3e50f76ad98e42287f1935d8dc2f6611",
"sha256": "c5bf4bd483589022d4d9c72bfd54184e41a5a991640b4982e9a3996a6815e01c"
},
"downloads": -1,
"filename": "zyte_api-0.7.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3e50f76ad98e42287f1935d8dc2f6611",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 20108,
"upload_time": "2025-02-17T05:02:16",
"upload_time_iso_8601": "2025-02-17T05:02:16.880252Z",
"url": "https://files.pythonhosted.org/packages/23/48/b2739961079a266353f8c00e0de3a5b1b0bed4da8f094884941df84a9aee/zyte_api-0.7.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "51029f87a2af628f81b665b340dbd1fe4bb2702bf9cf04e493641bfa6833aa5d",
"md5": "f355d01ac2bd536f02d1f1efbb6ef784",
"sha256": "32355b4feb79e9d65c1078ae57187a8ebbf8597469906317919dc275b752b709"
},
"downloads": -1,
"filename": "zyte_api-0.7.0.tar.gz",
"has_sig": false,
"md5_digest": "f355d01ac2bd536f02d1f1efbb6ef784",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 28452,
"upload_time": "2025-02-17T05:02:18",
"upload_time_iso_8601": "2025-02-17T05:02:18.742420Z",
"url": "https://files.pythonhosted.org/packages/51/02/9f87a2af628f81b665b340dbd1fe4bb2702bf9cf04e493641bfa6833aa5d/zyte_api-0.7.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-17 05:02:18",
"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"
}