WARNING: This version was yanked due to a missing requirement. Please upgrade to v6.0.1.
New features
- Async support!
- Every method now has an equivalent
*_async
variant
- Every method now has an equivalent
- Typed responses
- Every method will return a typed object from
pydantic
instead of raw JSON response - For example,
client.users.get(…)
would return astytch.models.users.GetResponse
- The sync and async APIs return the same
*Response
models, so the same is true forawait client.users.get_async(...)
- The sync and async APIs return the same
- Every method will return a typed object from
- Better error handling
- Responses are still thrown as
StytchError
(you should always use atry
/except
block when calling the API) - In addition, any bad response from the API (including server 500 errors) are now also packaged into a
StytchError
- No more special handling of
requests.JSONDecodeError
- No more special handling of
- Responses are still thrown as
Breaking changes
This is a major update to the stytch-python library, so you should carefully check all existing callsites for compatibility. There are two major breaking changes:
- Responses are now typed, so instead of
resp["user_id"]
, you may use something likeresp.user_id
Name
andSearchQuery
are typed objects now and should be used with relevant API endpoints instead of manually constructing mixed-typeDict[str, Any]
objects- The minimum supported Python version has been updated to
3.7
Upgrade guide
- When upgrading from 5.X to 6.0, you should check all callsites and ensure you're using the typed response objects instead of the old-style version that relies on indexing into untyped JSON
- If you are using any endpoint with
Name
orSearchQuery
parameters, upgrade those to instead use the typed models fromstytch.core.models