Registry / http-networking / zyte-api

zyte-api

JSON →
library0.10.0pypypi✓ verified 79d ago

The `zyte-api` Python client provides an asynchronous interface to the Zyte API, enabling programmatic access to web scraping functionalities such as smart browser rendering, automatic content extraction, and HTTP requests. It handles API communication, retries, and result parsing. Currently at version 0.9.0, it sees active development with frequent minor releases.

pip install zyte-api
INSTALL
IMPORT
SIG · ZYTE-API
Z
zyte-api
http-networkingpythonv0.10.0
Install
5.1s avg
Import
Disk
33MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.10.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 33.6MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 5.1s · import 0.000s · 37MB
33MB installed
● package 33MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ZyteAPI
from zyte_api import ZyteAPI
from zyte_api.zyte_api import ZyteAPI
AsyncZyteAPI
from zyte_api import AsyncZyteAPI
AggressiveRetryFactory
from zyte_api import AggressiveRetryFactory

This quickstart demonstrates how to initialize the `ZyteAPI` client with an API key (preferably from an environment variable) and make an asynchronous `request_render` call to fetch HTML, a screenshot, and page data for a given URL. It uses `asyncio.run()` to execute the asynchronous operation.

import os import asyncio from zyte_api.zyte_api import ZyteAPI api_key = os.environ.get('ZYTE_API_KEY', '') # Set ZYTE_API_KEY environment variable or replace with your key async def main(): if not api_key: print("ZYTE_API_KEY environment variable not set. Skipping quickstart example.") return api = ZyteAPI(api_key=api_key) try: print("Making a request to Zyte API for www.zyte.com...") result = await api.request_render( url="https://www.zyte.com/", browserHtml=True, screenshot=True, httpResponseBody=True, javascript=True ) print(f"Request Status: {result.status}") if result.browserData: print(f"Page title: {result.browserData.title}") if result.browserHtml: print(f"HTML (first 100 chars): {result.browserHtml[:100]}...") if result.screenshot: print(f"Screenshot (base64, first 50 chars): {result.screenshot[:50]}...") print("Successfully received Zyte API response.") except Exception as e: print(f"An error occurred: {e}") if __name__ == '__main__': asyncio.run(main())
zyte-api --version
Debug
Known issues
breakingStarting from version 0.6.0, `ZyteAPI` methods (e.g., `request_render`) return a `RequestResult` object instead of a dictionary. Access data using dot notation (e.g., `result.browserData.title`) instead of dictionary-like square brackets (`result['browserData']['title']`).
fix
Update your code to use attribute access for `RequestResult` objects, e.g., `result.field_name`.
affects: >=0.6.0
gotchaThe `ZyteAPI` client is primarily asynchronous. All API request methods (e.g., `request_render`) are coroutines and must be `await`ed within an `async` function. Running directly without `await` will result in `RuntimeWarning: coroutine was never awaited`.
fix
Wrap your API calls in an `async` function and use `await` for each call. Execute the main `async` function using `asyncio.run()`.
affects: all
gotchaThe Zyte API key is mandatory for authentication. It must be provided either via the `ZYTE_API_KEY` environment variable or passed directly to the `ZyteAPI` constructor as the `api_key` argument. Failure to do so will result in authentication errors.
fix
Ensure `os.environ['ZYTE_API_KEY']` is set with your valid Zyte API key, or instantiate the client as `api = ZyteAPI(api_key='YOUR_KEY')`.
affects: all
breakingSupport for Python 3.7 was dropped in version 0.7.0. If you are using Python 3.7, you must either upgrade your Python version to 3.8 or higher, or pin your `zyte-api` dependency to a version less than 0.7.0 (e.g., `zyte-api<0.7.0`).
fix
Upgrade your Python environment to 3.8 or newer, or specify `zyte-api<0.7.0` in your `requirements.txt`.
affects: >=0.7.0
Upgrade
Version history
0.10.0latest on PyPI · released Apr 28, 2026
Audit
Dependencies
aiohttprequiredProvides asynchronous HTTP client capabilities for API communication.
attrsrequiredUsed for defining data classes for API request and response models.
Agent activity
49 hits · last 30 days
node
44
OpenAI (training)
1
Resources
zyte-api — pip install zyte-api · libregistry