API key¶
After you sign up for a Zyte API account, copy your API key.
It is recommended to configure your API key through an environment variable, so that it can be picked by both the command-line client and the Python client library:
On Windows:
> set ZYTE_API_KEY=YOUR_API_KEY
On macOS and Linux:
$ export ZYTE_API_KEY=YOUR_API_KEY
Alternatively, you may pass your API key to the clients directly:
To pass your API key directly to the command-line client, use the
--api-key
switch:zyte-api --api-key YOUR_API_KEY …
To pass your API key directly to the Python client classes, use the
api_key
parameter when creating a client object:from zyte_api import ZyteAPI client = ZyteAPI(api_key="YOUR_API_KEY")
from zyte_api import AsyncZyteAPI client = AsyncZyteAPI(api_key="YOUR_API_KEY")