SDK Version 1.11.0 Release
Version 1.11.0 of the Benchling SDK introduces a helper function verify for verifying webhooks, and deprecates the verify_app_installation in the benchling_sdk.apps.helpers.webhook_helpers module. When polling for Async tasks with benchling.tasks.wait_for_task(), the default max_wait_seconds has been raised from 30 seconds to 600 seconds. Other changes include new helper function for references in App Status, support for Python 3.12, and a bug fix in OAuthClientCredentials.
What’s Changing?
Added
- Added
verify()function inbenchling_sdk.apps.helpers.webhook_helpersfor verifying webhooks received from Benchling, wich replaces the now deprecatedverify_app_installation. This uses the new URL https://apps.benchling.com/api/v1/apps/{app_definition_id}/jwks for retrieving JWKs for verifying webhook signatures. See Webhook Security for more info on webhook verification. This function replacesverify_app_installationfor Global Apps; check out the Global Apps FAQ for more details. - Added a new
ref_by_id(id: str)function to thebenchling_sdk.apps.status.helpersmodule. This enables referencing a Benchling object in an App Status message using just the object’s ID. - Verified support for Python 3.12.
Changed
- Increased default wait time (
max_wait_seconds) when usingbenchling.tasks.wait_for_task()to 600 seconds from 30 seconds.- Previously, tasks that exceed 30 seconds would cause a WaitForTaskExpiredError exception to be raised. Now, the
wait_for_task()function will wait for up to 10 minutes before raising the exception. This reflects the time the SDK will poll Benchling to check if a task was completed, but does not affect the task’s actual completion status in Benchling.- Note: This might cause an increase in infrastructure timeouts in time-constrained environments like serverless functions (e.g. AWS Lambda)
- The default wait time can be can be overwritten, for example: wait_for_task(max_wait_seconds=custom_value). Code that already sets max_wait_seconds instead of using the default is unaffected by this change.
- Previously, tasks that exceed 30 seconds would cause a WaitForTaskExpiredError exception to be raised. Now, the
Fixed
- Fixed a bug in OAuthClientCredentials where a JSONDecodeError would sometimes be raised when an HTTP error status code was returned. This will now log a debug message and raise BenchlingError.
Deprecated
benchling_sdk.apps.helpers.webhook_helpers.verify_app_installationis now deprecated in favor ofbenchling_sdk.apps.helpers.webhook_helpers.verify
When is this happening?
Version 1.11.0 of the Benchling SDK is now live! Find the SDK in PyPI.
Entity upsert endpoints promoted to stable
A number of upsert endpoints are being promoted from v2-beta to the v2 stable API. The new v2 stable endpoints are now live; the corresponding v2-beta endpoints are now deprecated, and will be fully sunset at a later date.
What’s changing?
A collection of endpoints that support an upsert operation are being promoted to the v2 stable API. When provided with a list of objects that includes a Registry ID, these upsert endpoints either update an existing entity (if an entity with that Registry ID already exists) or create a new entity (if an entity with that Registry ID not does already exist). You can also use Registry IDs in schema field values to link to entities being created in the same upsert request.
The following endpoints have been promoted to v2 stable and marked deprecated in v2-beta.
PATCH /dna-sequences/{entity_registry_id}:upsertPATCH /dna-oligos/{entity_registry_id}:upsertPATCH /rna-sequences/{entity_registry_id}:upsertPATCH /rna-oligos/{entity_registry_id}:upsertPATCH /aa-sequences/{entity_registry_id}:upsertPATCH /custom-entities/{entity_registry_id}:upsertPATCH /molecules/{entity_registry_id}:upsertPOST /entities:bulk-upsertPOST /dna-sequences:bulk-upsertPOST /dna-oligos:bulk-upsertPOST /rna-sequences:bulk-upsertPOST /rna-oligos:bulk-upsertPOST /aa-sequences:bulk-upsertPOST /custom-entities:bulk-upsertPOST /molecules:bulk-upsert
When is this happening?
The new v2 stable upsert endpoints are now live! The corresponding v2-beta endpoints are now deprecated, and will be fully sunset at a later date. If you are currently using any v2-beta upsert endpoints, please migrate to the corresponding v2 stable versions.