HTTPClient
HTTPClient¶
Synchronous HTTP client
Attributes¶
account
property
¶
account: LightAccount
Get the LightAccount instance (this is not a web3 contract instance).
Functions¶
connect
¶
connect() -> None
Connect to Derive and validate credentials, fetch and cache market instruments.
fetch_subaccount
¶
fetch_subaccount(subaccount_id: int) -> Subaccount
Fetch a subaccount from API and cache it.
fetch_subaccounts
¶
fetch_subaccounts() -> list[Subaccount]
Fetch subaccounts from API and cache them.
from_env
classmethod
¶
from_env(
session_key_path: Path | None = None,
env_file: Path | None = None,
) -> HTTPClient
Create the HTTPClient instance.
timeout
¶
timeout(seconds: float) -> Generator[None, None, None]
Temporarily overwrite client's HTTPSession's request_timeout.