diff --git a/src/zenrows/crawl/client.py b/src/zenrows/crawl/client.py index dac1517..181745c 100644 --- a/src/zenrows/crawl/client.py +++ b/src/zenrows/crawl/client.py @@ -42,7 +42,9 @@ ) _DEFAULT_BASE_URL = "https://api.zenrows.com/v1" -DEFAULT_USER_AGENT = f"zenrows-crawl-python/{__version__}" +# The scraping client's User-Agent, so the API reads Crawl requests as +# Python SDK traffic. +DEFAULT_USER_AGENT = f"zenrows/{__version__} python" _log = logging.getLogger("zenrows.crawl.transport") diff --git a/tests/test_crawl_client.py b/tests/test_crawl_client.py index 4b7267f..e097ad0 100644 --- a/tests/test_crawl_client.py +++ b/tests/test_crawl_client.py @@ -13,6 +13,7 @@ from httpx import Response from zenrows import ZenRowsCrawlClient +from zenrows.__version__ import __version__ from zenrows.batch._open_enum import is_unknown from zenrows.crawl import ( CRAWL_NOT_ENABLED_CODE, @@ -107,6 +108,7 @@ def test_create_sends_only_required_fields(client: ZenRowsCrawlClient): assert crawl.depth is None # created without depth: no depth limit, none echoed sent = route.calls.last.request assert sent.headers["X-API-Key"] == API_KEY + assert sent.headers["User-Agent"] == f"zenrows/{__version__} python" assert sent.headers["Content-Type"] == "application/json" assert "Idempotency-Key" not in sent.headers assert json.loads(sent.content) == {"url": "https://example.com/"}