feat: add async support - #73
Conversation
|
For context: this follows up on PR #11 from last year. |
|
Thanks for your PR, this will be a great improvement. I need to have a more thorrow look at this before merging but overall it looks good! One thing though, could you maybe split the commits into multiple ones? I think the query param functions being moved to _params.py can be a separate commit. It'll be easier to review 🙂 |
|
Split into two commits as you suggested. Params function only returns params and not url. Constants for each function. |
|
I have tested the code and it looks fine to me! There should not be any breaking changes here from what I can tell. If you want to, feel free to add another commit updating the Thanks for your contribution! This will be a significant improvement 🚀 |
|
I've changed the readme now |
Summary
Adds
AsyncBlocketAPIfor async/await support. All search parameter logic is extracted into a shared_params.pymodule so the sync and async wrappers follow DRY — zero duplicated URL/param construction.Architecture
blocket_api/_params.py— pure functions that return(url, httpx_params)for every endpointblocket_api/blocket.py— refactored to delegate to_params.py(no more inlineQueryParamlogic)blocket_api/async_blocket.py— newAsyncBlocketAPIclass usinghttpx.AsyncClient, supportsasync withtests/async_requests.py— 11 async tests mirroring the existing sync suiteUsage
Verification
mypyreports no type errors