v1.0.0
Migration guide from seamapi to seam
Learn how to migrate from the seamapi
package to the seam
package. This guide includes descriptions of all breaking changes.
The new SDK has fewer dependencies and is generated daily to ensure methods and types are always up-to-date with the latest API changes. It is mostly a drop-in replacement, however some method signatures and options have changed to improve overall consistency with the Seam API.
This guide includes descriptions of all breaking changes. Please refer to the README for updated usage instructions and a complete list of new features.
New Python package name
Changed the package name from seamapi
to seam
.
- pip install seamapi
+ pip install seam
- from seamapi import Seam
+ from seam import Seam
Updated API method signatures
Keyword arguments
API method signatures now only accept keyword arguments.
- seam.access_codes.get("your-access-code-id")
+ seam.access_codes.get(access_code_id="your-access-code-id")
- seam.devices.get("your-device-id")
+ seam.devices.get(device_id="your-device-id")
Standardized resource ID arguments
Changed from accepting both resource objects and resource ID strings to accepting only resource ID strings. Includes a renaming scheme for clarity.
- def get(resource: Union[str, Resource]) -> Resource
+ def get(resource_id: str) -> Resource
Usage
- seam.devices.get(device=your_device)
+ seam.devices.get(device_id=your_device.device_id)
Removed method arguments
Removed wait_for_code
from access_codes.create
. Use the newly-created access_code_id
to poll or watch for events.
Return value changes
Changed the return values for some methods to enhance API consistency and reliability.
The following methods now return None
:
access_codes.delete
: Instead, you should wait for theaccess_code.deleted
event.access_codes.update
: Instead, you should watch for relevantaccess_code.*
events or poll the resource as needed.access_codes.unmanaged.delete
access_codes.unmanaged.convert_to_managed
: Instead, you should wait for theaccess_code.unmanaged.converted_to_managed
andaccess_code.unmanaged.failed_to_convert_to_managed
events.noise_sensors.noise_thresholds.delete
: Instead, you should wait for thenoise_threshold.deleted
event.noise_sensors.noise_thresholds.update
: Instead, you should watch for relevantnoise_threshold.*
events or poll the resource as needed.thermostats.climate_setting_schedules.update
: Instead, you should watch for relevantclimate_setting_schedule.*
events or poll the resource as needed.
The following methods now return a NoiseThreshold
:
noise_sensors.noise_thresholds.create
: Use the newly-creatednoise_threshold_id
to poll or watch for events.
The following methods now return an ActionAttempt
:
workspaces.reset_sandbox
: Instead, you should use the newly-createdaction_attempt_id
to poll the status of the action attempt via the/action_attempt/get
endpoint.
Action attempt resolution
Methods returning action attempts still wait for the action attempt to resolve by default. Further, you can now configure this behavior using the wait_for_action_attempt
option on a per-request basis. You can also set the default behavior for the client.
Set per request
# Wait for the action attempt to be ready with a default timeout of 5.0 seconds and a default polling interval of 0.5 seconds.
seam.locks.lock_door(
device_id="your-device-id",
wait_for_action_attempt=True
)
# Wait up to 10 seconds for the action attempt to be ready, checking every 2 seconds.
seam.locks.lock_door(
device_id="your-device-id",
wait_for_action_attempt={
"timeout": 10.0, # Up to 10 seconds
"polling_interval": 2.0 # Every 2 seconds
}
)
Set default behavior
seam = Seam(wait_for_action_attempt=True)
Environment variables
Added support for the SEAM_ENDPOINT
environment variable.
Third-party component support and version changes
- Updated the minimum supported Python version to 3.9.
- Updated the
dataclasses-json
version to 0.6. - Removed Sentry support.
- Replaced
requests
withniquests
version 3.
Highlighted new features
API key authentication with from_api_key
factory method
Added a new from_api_key
factory method for API key authentication of the Seam
client.
seam = Seam.from_api_key("your-api-key")
PAT authentication scoped to a single workspace
Added support for workspace personal access token (PAT) authentication.
# Pass as an option to the constructor
seam = Seam(
personal_access_token="your-personal-access-token",
workspace_id="your-workspace-id",
)
# Use the factory method
seam = Seam.from_personal_access_token(
"your-personal-access-token",
"your-workspace-id",
)
PAT authentication not bound to a specific workspace
For authentication with a personal access token not bound to a specific workspace, use SeamMultiWorkspace
.
from seam import SeamMultiWorkspace
# Pass as an option to the constructor
seam_multi_workspace = SeamMultiWorkspace(personal_access_token="your-personal-access-token")
# Use the factory method
seam_multi_workspace = SeamMultiWorkspace.from_personal_access_token("your-personal-access-token")
workspace = seam_multi_workspace.workspaces.create(company_name="Example Inc.")
Webhook handler
SDK exports a thin wrapper SeamWebhook
around the svix package. Use it to parse and validate Seam webhook events.