===============
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.8+ 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/57/73/d87877428e01fe2c725ca4b8fdef945cb216172f65b66b96a2e327516058/zyte-api-0.5.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.8+ 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.5.0",
"project_urls": {
"Homepage": "https://github.com/zytedata/python-zyte-api"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d6c833104bcaef3266ae7940db75b16b94ae96468ccbdb642a852b3b038fff8f",
"md5": "a3b0129f50cd9a53b427335340b9cbbd",
"sha256": "5866f18ecb7ed4c6e501e4be9874f93129de74b0af95744504a483a763c2e9ac"
},
"downloads": -1,
"filename": "zyte_api-0.5.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a3b0129f50cd9a53b427335340b9cbbd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 18885,
"upload_time": "2024-04-05T12:41:02",
"upload_time_iso_8601": "2024-04-05T12:41:02.702328Z",
"url": "https://files.pythonhosted.org/packages/d6/c8/33104bcaef3266ae7940db75b16b94ae96468ccbdb642a852b3b038fff8f/zyte_api-0.5.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5773d87877428e01fe2c725ca4b8fdef945cb216172f65b66b96a2e327516058",
"md5": "4ffe2f9447ca62f50667c6f0c445ef43",
"sha256": "bbd63644202ae3705ca43a2af5a6a4efac511312c690cecfd8ab20e5b0766500"
},
"downloads": -1,
"filename": "zyte-api-0.5.0.tar.gz",
"has_sig": false,
"md5_digest": "4ffe2f9447ca62f50667c6f0c445ef43",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 23871,
"upload_time": "2024-04-05T12:41:03",
"upload_time_iso_8601": "2024-04-05T12:41:03.936246Z",
"url": "https://files.pythonhosted.org/packages/57/73/d87877428e01fe2c725ca4b8fdef945cb216172f65b66b96a2e327516058/zyte-api-0.5.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-05 12:41:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "zytedata",
"github_project": "python-zyte-api",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"tox": true,
"lcname": "zyte-api"
}