Client
Client for interacting with the Lightwheel API.
LightwheelClient
Main client for interacting with the Lightwheel API.
class LightwheelClient:
def __init__(self, *, host: str = "", base_timeout: int = 10)
Constructor Parameters
host(str): API endpoint URL. Defaults toLW_API_ENDPOINTenvironment variable orhttps://api.lightwheel.netbase_timeout(int): Default timeout for HTTP requests in seconds. Default: 10
Methods
login()
def login(
self,
force_login: bool = False,
*,
username: str = None,
password: str = None
) -> Dict[str, str]
Authenticate with the API.
Parameters:
force_login(bool): Force fresh login, ignoring cache. Default: Falseusername(str, optional): Username for authenticationpassword(str, optional): Password for authentication
Returns: Dictionary of authentication headers
Raises:
ApiException: API request failedAuthenticationFailedException: Authentication failed
logout()
def logout(self) -> None
Clear authentication and remove cached credentials.
post()
def post(
self,
path: str,
*,
data: Dict[str, Any] = None,
timeout: int = None
) -> requests.Response
Make POST request to API.
Parameters:
path(str): API endpoint pathdata(dict, optional): Request body datatimeout(int, optional): Request timeout in seconds
Returns: Response object
Raises:
ApiException: API request failedAuthenticationFailedException: Authentication failedUnknownException: Unexpected error
Login
High-level interface for authentication management.
class Login:
def __init__(self, client: LightwheelClient)
Methods
login()
def login(
self,
force_login: bool = False,
*,
username: str = None,
password: str = None
)
Login to the API (delegates to LightwheelClient.login()).
logout()
def logout(self)
Logout from the API (delegates to LightwheelClient.logout()).
Pre-configured Instances
The SDK provides pre-configured instances for convenience:
from lightwheel_sdk.loader import (
lw_client, # LightwheelClient instance
login_manager, # Login instance
object_loader, # ObjectLoader instance
floorplan_loader, # FloorplanLoader instance
scene_loader # SceneLoader instance
)
These instances use the default endpoint from LW_API_ENDPOINT environment variable or https://api.lightwheel.net.