Zyte API initial setup#
Zyte API is an HTTP API with JSON-encoded requests and responses that can be used with any HTTP client software, and we provide code examples for many different technologies, including Zyte API client software.
You can also use Zyte API from the Zyte dashboard, so you can easily test Zyte API requests, e.g. to calculate costs.
Zyte API client software#
Zyte maintains the following solutions that make using Zyte API easier:
python-zyte-api is a Python package that offers both a command-line client and an asyncio API.
scrapy-zyte-api is a Scrapy plugin.
Tip
scrapy-zyte-api is featured in Zyte API tutorial.
Code examples#
The Zyte API usage documentation features code examples with different software stacks.
Select a software stack from the tabs below to learn how to install and configure the requirements to run code examples for that software stack:
C# code examples use C# 9.0.
To run C# code examples, install:
.NET SDK 5.x or later
Html Agility Pack, for HTML parsing
CLI code examples feature curl and other command-line tools.
To run CLI code examples, install:
curl, for requests.
Note
curl comes pre-installed in many operating systems.
jq, for JSON parsing.
base64, for base64 encoding and decoding.
On Windows, you can use chocolatey to install GNU Core Utilities, which includes a
base64
command-line application.macOS comes with a
base64
command-line application pre-installed.Most Linux distributions come with GNU Core Utilities pre-installed, or make it easy to install it. GNU Core Utilities includes a
base64
command-line application.
xmllint, for HTML parsing.
On Windows, install libxml2, which provides
xmllint
.macOS comes with
xmllint
pre-installed.Most Linux distributions make it easy to install libxml2, which provides
xmllint
.
xargs, for parallelization.
On Windows, you can use chocolatey to install GNU findutils, which includes a
xargs
command-line application.macOS comes with a
xargs
command-line application pre-installed.Most Linux distributions come with GNU findutils pre-installed, or make it easy to install it. GNU findutils includes a
xargs
command-line application.
CLI (best) code examples feature the command-line interface of python-zyte-api, the official Python client of Zyte API, along with other command-line tools.
To run CLI (best) code examples, install:
python-zyte-api, for requests.
Requires installing Python first.
jq, for JSON parsing.
base64, for base64 encoding and decoding.
On Windows, you can use chocolatey to install GNU Core Utilities, which includes a
base64
command-line application.macOS comes with a
base64
command-line application pre-installed.Most Linux distributions come with GNU Core Utilities pre-installed, or make it easy to install it. GNU Core Utilities includes a
base64
command-line application.
xmllint, for HTML parsing.
On Windows, install libxml2, which provides
xmllint
.macOS comes with
xmllint
pre-installed.Most Linux distributions make it easy to install libxml2, which provides
xmllint
.
xargs, for parallelization.
On Windows, you can use chocolatey to install GNU findutils, which includes a
xargs
command-line application.macOS comes with a
xargs
command-line application pre-installed.Most Linux distributions come with GNU findutils pre-installed, or make it easy to install it. GNU findutils includes a
xargs
command-line application.
Java code examples use Java SE 8.
To run Java code examples, install:
JS code examples use JavaScript.
To run JS code examples, install:
PHP code examples use PHP 7.4.
To run PHP code examples, install:
Python code examples use Python 3.
To run Python code examples, install:
Python (best) code examples feature the asyncio API of python-zyte-api, the official Python client of Zyte API.
To run Python (best) code examples, install:
python-zyte-api, for requests.
Parsel for HTML parsing.
Scrapy code examples feature Scrapy with the scrapy-zyte-api plugin configured in transparent mode.
To run Scrapy code examples, install:
After installing scrapy-zyte-api, you must also configure it in your Scrapy project, and enable its transparent mode, following the upstream configuration instructions.
Tip
The Zyte API tutorial covers installing and configuring the requirements for Scrapy code examples.