improved
SDK Version 1.11.0 Release
8 months ago by Derek Gervais
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_helpers
for 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_installation
for 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.helpers
module. 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_installation
is 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.