Using The Pooling Client
In this example, we explain how the egytech_api PoolingClient can be used to leverage connection pooling and make multiple requests at once by just specifying the request parameters in a dictionary.
Create Your Queries
In order to use the Pooling Client for making multiple API calls, we have to prepare our queries first as such:
First Method (Recommended):
In this method, we create multiple ParticipantsQueryParams
objects and compile them into a list:
Second Method:
In this method, we simply create a list of dictionaries, each of which represent one query. This will unfortunately not be compatible with code auto-complete and your IDE won't be able to check if you have made the right inputs as you type. Instead, you'll find out during run-time.
Initialize A PoolingClient Instance & Fetch The Data
Here, we initialize an instance of egytech_api.core.PoolingClient. This client automatically executes the api calls with the given parameters, leveraging connection pooling, a feature provided by httpx. The client then aggregates the resulting data into a pandas.DataFrame instance which you can use for whatever you want.
Last updated