{"id":22344,"library":"scrapy-zyte-api","title":"Scrapy Zyte API","description":"Client library to process URLs through Zyte API (formerly Crawlera). Enables Scrapy spiders to use Zyte's proxy rotation and data extraction services. Current version: 0.33.1. Release cadence: monthly.","status":"active","version":"0.33.1","language":"python","source_language":"en","source_url":"https://github.com/scrapy/scrapy-zyte-api","tags":["scrapy","zyte","web-scraping","proxy","api"],"install":[{"cmd":"pip install scrapy-zyte-api","lang":"bash","label":"Python package"}],"dependencies":[],"imports":[{"note":"Correct import for the middleware class.","wrong":"","symbol":"ZyteAPI","correct":"from scrapy_zyte_api import ZyteAPI"},{"note":"Alias for backward compatibility; still works.","wrong":"","symbol":"ScrapyZyteAPIDownloaderMiddleware","correct":"from scrapy_zyte_api import ScrapyZyteAPIDownloaderMiddleware"}],"quickstart":{"code":"import os\nfrom scrapy_zyte_api import ZyteAPI\n\napi_key = os.environ.get('ZYTE_API_KEY', '')\nzym = ZyteAPI(api_key=api_key, downloader_middleware_settings={\n    'ZYTE_API_DOWNLOADER_MIDDLEWARE_ENABLED': True,\n    'ZYTE_API_ENABLED': True,\n})\n\n# Then add to your Scrapy settings:\n# DOWNLOADER_MIDDLEWARES = {\n#     'scrapy_zyte_api.ZyteAPI': 1000,\n# }\n# ZYTE_API_KEY = api_key","lang":"python","description":"Quickstart: Instantiate ZyteAPI and configure settings for Scrapy."},"warnings":[{"fix":"Upgrade to Python 3.10+ or pin to <0.33.0.","message":"Version 0.33.0 dropped Python 3.9 support (min is 3.10).","severity":"breaking","affected_versions":">=0.33.0,<0.33.0"},{"fix":"Use new import syntax and pass api_key via settings or env var.","message":"In 0.33.0, the middleware class was renamed from ScrapyZyteAPIDownloaderMiddleware to ZyteAPI. The old import still works as an alias, but the class no longer accepts the same constructor parameters.","severity":"breaking","affected_versions":">=0.33.0"},{"fix":"Replace ZYTE_API_DOWNLOADER_MIDDLEWARE_ENABLED with ZYTE_API_ENABLED in settings.","message":"The old setting ZYTE_API_DOWNLOADER_MIDDLEWARE_ENABLED is deprecated; use ZYTE_API_ENABLED instead.","severity":"deprecated","affected_versions":">=0.30.0"},{"fix":"Set env var before running spider: export ZYTE_API_KEY='your_key'.","message":"The API key must be provided via ZYTE_API_KEY environment variable or explicitly passed, not just set in settings.py when using the middleware.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run: pip install scrapy-zyte-api","cause":"Library not installed or installed in wrong environment.","error":"ModuleNotFoundError: No module named 'scrapy_zyte_api'"},{"fix":"Use ZyteAPI class instead: from scrapy_zyte_api import ZyteAPI","cause":"Using old class ScrapyZyteAPIDownloaderMiddleware directly with api_key argument, which is no longer supported in latest version (0.33+).","error":"TypeError: __init__() got an unexpected keyword argument 'api_key'"},{"fix":"Set the environment variable ZYTE_API_KEY before running Scrapy, or ensure it is passed to middleware.","cause":"API key not provided anywhere.","error":"scrapy.exceptions.NotConfigured: Zyte API key not found. Please set ZYTE_API_KEY environment variable."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}