Pass timeout as configuration in EHRClient #67
Labels
Component: Sandbox
Issue/PRs that deal with the client and server components of the sandbox
good first issue
Good for newcomers
hacktoberfest
Issues suitable for hacktoberfest
Description
In the
EHRClient.send_request
method, we currently have a hardcoded timeout value. We need to modify this to accept a configurable timeout value.HealthChain/healthchain/clients/ehrclient.py
Line 153 in a4beb13
Context
This change is important because different environments and use cases may require different timeout settings. For example, in development, we might want a longer timeout for debugging, while in production, we might need stricter timeouts. Making this configurable will benefit other users by allowing them to fine-tune the client's behavior to their specific needs without modifying the core code.
Possible Implementation
Add a
timeout
parameter to theEHRClient
constructor with a default value:Update the
send_request
method to use the configured timeout:Update docstrings and type hints accordingly.
Modify existing tests and add new ones to cover the timeout configuration.
Possible Alternatives
Instead of a simple float, we could use a more complex timeout configuration object that allows setting connect, read, and write timeouts separately.
We could implement a global configuration system for the entire library, where timeout would be just one of many configurable options.
We could use environment variables for configuration, allowing users to set timeouts without changing code.
The text was updated successfully, but these errors were encountered: