Skip to main content

Python interface to Zyte API

Project description

PyPI Version Supported Python Versions Build Status Coverage report

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zyte-api-0.5.0.tar.gz (23.9 kB view details)

Uploaded Source

Built Distribution

zyte_api-0.5.0-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

Details for the file zyte-api-0.5.0.tar.gz.

File metadata

  • Download URL: zyte-api-0.5.0.tar.gz
  • Upload date:
  • Size: 23.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for zyte-api-0.5.0.tar.gz
Algorithm Hash digest
SHA256 bbd63644202ae3705ca43a2af5a6a4efac511312c690cecfd8ab20e5b0766500
MD5 4ffe2f9447ca62f50667c6f0c445ef43
BLAKE2b-256 5773d87877428e01fe2c725ca4b8fdef945cb216172f65b66b96a2e327516058

See more details on using hashes here.

File details

Details for the file zyte_api-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: zyte_api-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 18.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for zyte_api-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5866f18ecb7ed4c6e501e4be9874f93129de74b0af95744504a483a763c2e9ac
MD5 a3b0129f50cd9a53b427335340b9cbbd
BLAKE2b-256 d6c833104bcaef3266ae7940db75b16b94ae96468ccbdb642a852b3b038fff8f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page