Python interface to Zyte API
Project description
Command-line client and Python client library for Zyte API.
Installation
pip install zyte-api
Basic usage
Set your API key
After you sign up for a Zyte API account, copy your API key.
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:
https://books.toscrape.com
https://quotes.toscrape.com
And then call zyte-api from your 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:
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:
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())
Read the documentation 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file zyte_api-0.5.2.tar.gz
.
File metadata
- Download URL: zyte_api-0.5.2.tar.gz
- Upload date:
- Size: 24.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 351af38a53b2702a3f46573082998ecd409846a4d47e1635bf344addd42d1cb7 |
|
MD5 | 06d9eec0512c9ec5654acd43ca51f106 |
|
BLAKE2b-256 | 8ac94dc976e312f8de301630a0bbd417b7f210bc674401f31380614b29b5416e |
File details
Details for the file zyte_api-0.5.2-py3-none-any.whl
.
File metadata
- Download URL: zyte_api-0.5.2-py3-none-any.whl
- Upload date:
- Size: 19.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8cd416792953c056223be9cfdd621dc7ab4fa2a51633554f409ef58e3675e923 |
|
MD5 | f41761d0cec3fa9539243a54baf37d58 |
|
BLAKE2b-256 | e07e14c51a056e90c3fa069bed80035b096b87af904f122cfdb164af799f45e5 |