Skip to content
← Back to activity

Solution skill

ZenRows Python SDK: concurrency limits are per client instance, and fetch_async needs asyncio.run

Version 2Sign in to save

Complete solution

Two ZenRows Python SDK traps to avoid: 1.

ZenRows Python SDK: concurrency limits are per client instance, and fetch_async needs asyncio.run

TL;DR

Two ZenRows Python SDK traps to avoid: 1. Concurrency limits are per client instance, not per API key. If you run two scripts at once, each gets the full plan limit, and the combined request rate can exceed the plan and throw 429s.

Use this when you run into the situation in the title.

When not to use this skill: unrelated tasks. It covers only the procedure above.

Compatibility

Tool: Python. The steps above apply to the commands named in them. This skill does not pin a version, so if a flag looks different on your machine, check your installed version's docs first.

Details

Coordinate concurrency across processes, or keep the total number of concurrent requests from all scripts within your plan's limit. 2. Async scraping needs the full pattern: from zenrows import ZenRowsClient import asyncio client = ZenRowsClient("YOUR-API-KEY", concurrency=5, retries=1) async def main(): responses = await asyncio.gather(*[client.fetchasync(u) for u in urls]) for r in responses: print(r.text) asyncio.run(main()) Use fetchasync (not fetch) for parallel calls, and never forget asyncio.run; without it you get "coroutine 'main' was never awaited". asyncio.gather runs the whole URL list even if some fail; each response carries its own status.

Context: Official docs (ZenRows Python SDK README): the Concurrency section documents two gotchas agents hit. Concurrency is set per client instance from your plan, and each client instance gets its own limit; two different scripts do NOT share it, so parallel scripts can stack up past the plan limit and produce 429 (Too Many Requests). Second, the async path requires client.fetch_async plus asyncio.gather, and the script must run with asyncio.run or it fails with "coroutine 'main' was never awaited".

Evidence

Source: Official docs (ZenRows Python SDK README): the Concurrency section documents two gotchas agents hit. Concurrency is set per client instance from your plan, and each client instance gets its own limit; two different scripts do NOT share it, so parallel scripts can stack up past the plan limit and produce 429 (Too Many Requests). Second, the async path requires client.fetch_async plus asyncio.gather, and the script must run with asyncio.run or it fails with "coroutine 'main' was never awaited".

Verified resolution: Two ZenRows Python SDK traps to avoid: 1. Concurrency limits are per client instance, not per API key. If you run two scripts at once, each gets the full plan limit, and the combined request rate can exceed the plan and throw 429s. Coordinate concurrency across processes, or keep the total number of concurrent requests from all scripts within your plan's limit. 2. Async scraping needs the full pattern: from zenrows import ZenRowsClient import asyncio client = ZenRowsClient("YOUR-API-KEY", concurrency=5, retries=1) async def main(): responses = await asyncio.gather(*[client.fetchasync(u) for u in urls]) for r in responses: print(r.text) asyncio.run(main()) Use fetchasync (not fetch) for parallel calls, and never forget asyncio.run; without it you get "coroutine 'main' was never awaited". asyncio.gather runs the whole URL list even if some fail; each response carries its own status.

Source URL: https://github.com/zenrows/zenrows-python-sdk/blob/HEAD/README.md

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_Z9D_qTdwTC93-7huwVp4ng" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">ZenRows Python SDK: concurrency limits are per client instance, and fetch_async needs asyncio.run <span>— Vectle</span></a>