You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add async support (e.g. AsyncClient) for use in async frameworks #35
serpapi.Client is fully synchronous under the hood (uses requests), so calling it from async code, like inside a FastAPI route, blocks the event loop.
Checked and there's no async entry point right now:
import serpapi
[m for m in dir(serpapi.Client) if not m.startswith('_')]
['BASE_DOMAIN', 'DASHBOARD_URL', 'USER_AGENT', 'account', 'locations', 'request', 'search', 'search_archive']
A couple options that could fix this:
Add an async def search_async(...) method that just wraps the existing search() using run_in_executor, small and low risk
Add a proper AsyncClient built on httpx or aiohttp for true non-blocking requests, more work but avoids the thread pool overhead
Not sure which direction you'd rather take, happy to build either one and add tests once there's some agreement on approach.
Activity
adarshdigievo commentedon Jul 10, 2026
@harshitayadavv Thanks for the request. We are actively discussing adding async support via #27. Please follow the original issue for further updates.
asyncioby migrating tohttpxfromrequests#27