Quick Start
This page walks through a minimal example of using the SDK.
Install the package from PyPI:
pip install imednet
Set your credentials as environment variables (see Configuration for details):
export IMEDNET_API_KEY="your_api_key"
export IMEDNET_SECURITY_KEY="your_security_key"
Enable structured logging and list studies:
from imednet import ImednetSDK, load_config
from imednet.utils import configure_json_logging
configure_json_logging()
cfg = load_config()
sdk = ImednetSDK(
api_key=cfg.api_key,
security_key=cfg.security_key,
base_url=cfg.base_url,
)
studies = sdk.studies.list()
print(studies)
The example script Quick Start Script provides a runnable version that validates required environment variables.
For asynchronous usage, see Async Quick Start.
Cached endpoints can be refreshed with refresh=True
. The caches are not thread safe so long running applications should recreate the SDK when needed.
Custom retry logic can be provided via a RetryPolicy
:
from imednet.core.retry import RetryPolicy, RetryState
from imednet.core.exceptions import ServerError
class ServerRetry(RetryPolicy):
def should_retry(self, state: RetryState) -> bool:
return isinstance(state.exception, ServerError)
sdk = ImednetSDK(retry_policy=ServerRetry())
See Retry Policy and Error Handling for more guidance on error handling and exponential backoff.