stytch-9.6.0
9.6.0
9.5.1
9.5.0
9.4.0
9.3.1
9.3.0
9.2.0
9.1.0
9.0.0
8.7.0
8.6.0
8.5.1
8.5.0
8.4.0
8.3.0
8.2.0
8.1.0
8.0.4
8.0.3
8.0.2
8.0.1
8.0.0
7.9.0
7.8.0
7.7.4
7.7.3
7.7.2
7.7.1
7.7.0
7.6.0
7.5.0
7.4.0
7.3.1
7.3.0
7.2.2
7.2.1
7.2.0
7.1.0
7.0.2
7.0.1
7.0.0
6.9.0
6.8.0
6.7.1
6.7.0
6.6.0
6.5.0
6.4.0
6.3.2
6.3.1
6.3.0
6.2.2
6.2.1
6.2.0
6.11.0
6.10.0
6.1.1
6.1.0
6.0.3
6.0.2
6.0.1
6.0.0
5.9.0
5.8.0
5.7.0
5.6.0
5.5.0
5.4.0
5.3.0
5.2.1
5.2.0
5.17.0
5.15.0
5.14.0
5.13.0
5.12.0
5.11.2
5.11.1
5.11.0
5.10.1
5.10.0
5.1.1
5.1.0
5.0.1
5.0.0
4.9.0
4.8.0
4.7.0
4.6.0
4.5.0
4.4.0
4.3.2
4.3.1
4.3.0
4.2.0
4.13.0
4.12.1
4.12.0
4.11.0
4.10.0
4.1.2
4.1.1
4.1.0
4.0.2
4.0.1
4.0.0
3.0.0
2.0.0
14.2.0
14.1.0
14.0.0
13.9.0
13.8.0
13.7.0
13.6.0
13.5.0
13.4.0
13.3.0
13.28.1
13.28.0
13.27.0
13.26.1
13.26.0
13.25.0
13.24.0
13.23.0
13.22.0
13.21.0
13.20.1
13.20.0
13.2.0
13.19.0
13.18.0
13.17.0
13.16.0
13.15.0
13.14.1
13.14.0
13.13.1
13.13.0
13.12.0
13.11.0
13.10.0
13.1.0
13.0.0
12.9.0
12.8.0
12.7.0
12.6.0
12.5.0
12.4.0
12.3.0
12.2.0
12.13.0
12.12.1
12.12.0
12.11.0
12.10.1
12.10.0
12.1.0
12.0.0
11.9.0
11.8.0
11.7.0
11.6.0
11.5.0
11.4.1
11.4.0
11.3.0
11.2.0
11.11.0
11.10.0
11.1.0
11.0.0
10.1.0
10.0.0
1.3.5
1.3.3
1.3.2
1.3.1
1.3.0
1.2.2
1.2.1
1.2.0
1.1.3
1.1.2
1.1.1
1.1.0
1.0.9
1.0.8
1.0.7
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
14.2.0
14.1.0
14.0.0
13.9.0
13.8.0
13.7.0
13.6.0
13.5.0
13.4.0
13.3.0
13.28.1
13.28.0
13.27.0
13.26.1
13.26.0
13.25.0
13.24.0
13.23.0
13.22.0
13.21.0
13.20.1
13.20.0
13.2.0
13.19.0
13.18.0
13.17.0
13.16.0
13.15.0
13.14.1
13.14.0
13.13.1
13.13.0
13.12.0
13.11.0
13.10.0
13.1.0
13.0.0
12.9.0
12.8.0
12.7.0
12.6.0
12.5.0
12.4.0
12.3.0
12.2.0
12.13.0
12.12.1
12.12.0
12.11.0
12.10.1
12.10.0
12.1.0
12.0.0
11.11.0
1.2.0
1.1.1
1.0.7
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
توضیحات
Stytch python client
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | stytch-9.6.0 |
| نام | stytch |
| نسخه کتابخانه | 9.6.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Stytch |
| ایمیل نویسنده | hello@stytch.com |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/stytch/ |
| مجوز | MIT |
# Stytch Python Library
The Stytch Python library makes it easy to use the Stytch user infrastructure API in Python applications.
It pairs well with the Stytch [Web SDK](https://www.npmjs.com/package/@stytch/vanilla-js) or your own custom authentication flow.
## Requirements
The Stytch Python library supports Python 3.8+
## Installation
```
pip install stytch
```
## Usage
You can find your API credentials in the [Stytch Dashboard](https://stytch.com/dashboard/api-keys).
This client library supports all Stytch's live products:
## B2C
- [x] [Email Magic Links](https://stytch.com/docs/api/send-by-email)
- [x] [Embeddable Magic Links](https://stytch.com/docs/guides/magic-links/embeddable-magic-links/api)
- [x] [OAuth logins](https://stytch.com/docs/guides/oauth/idp-overview)
- [x] [SMS passcodes](https://stytch.com/docs/api/send-otp-by-sms)
- [x] [WhatsApp passcodes](https://stytch.com/docs/api/whatsapp-send)
- [x] [Email passcodes](https://stytch.com/docs/api/send-otp-by-email)
- [x] [Session Management](https://stytch.com/docs/guides/sessions/using-sessions)
- [x] [WebAuthn](https://stytch.com/docs/guides/webauthn/api)
- [x] [Time-based one-time passcodes (TOTPs)](https://stytch.com/docs/guides/totp/api)
- [x] [Crypto wallets](https://stytch.com/docs/guides/web3/api)
- [x] [Passwords](https://stytch.com/docs/guides/passwords/api)
## B2B
- [x] [Organizations](https://stytch.com/docs/b2b/api/organization-object)
- [x] [Members](https://stytch.com/docs/b2b/api/member-object)
- [x] [Email Magic Links](https://stytch.com/docs/b2b/api/send-login-signup-email)
- [x] [OAuth logins](https://stytch.com/docs/b2b/api/oauth-google-start)
- [x] [Session Management](https://stytch.com/docs/b2b/api/session-object)
- [x] [Single-Sign On](https://stytch.com/docs/b2b/api/sso-authenticate-start)
- [x] [Discovery](https://stytch.com/docs/b2b/api/discovered-organization-object)
- [x] [Passwords](https://stytch.com/docs/b2b/api/passwords-authenticate)
### Example B2C usage
Create an API client:
```python
import stytch
client = stytch.Client(
project_id="project-live-c60c0abe-c25a-4472-a9ed-320c6667d317",
secret="secret-live-80JASucyk7z_G8Z-7dVwZVGXL5NT_qGAQ2I=",
# Optionally specify a custom base URL for all API calls
# custom_base_url="https://api.custom-domain.com/",
)
```
Send a magic link by email:
```python
login_or_create_resp = client.magic_links.email.login_or_create(
email="sandbox@stytch.com",
login_magic_link_url="https://example.com/authenticate",
signup_magic_link_url="https://example.com/authenticate",
)
# Responses are fully-typed `pydantic` objects
print(login_or_create_resp)
```
Authenticate the token from the magic link:
```python
auth_resp = client.magic_links.authenticate(
token="DOYoip3rvIMMW5lgItikFK-Ak1CfMsgjuiCyI7uuU94=",
)
print(auth_resp)
```
## Async support
Every endpoint supports an `async` version which you can use by appending `_async` to the method name. You can use the
same `Client` object for `sync` and `async` methods. The above example of sending and authenticating an magic link can
be rewritten as:
```python
login_or_create_resp = await client.magic_links.email.login_or_create_async(
email="sandbox@stytch.com",
login_magic_link_url="https://example.com/authenticate",
signup_magic_link_url="https://example.com/authenticate",
)
print(login_or_create_resp)
auth_resp = await client.magic_links.authenticate(
token="DOYoip3rvIMMW5lgItikFK-Ak1CfMsgjuiCyI7uuU94=",
)
print(resp)
```
### Example B2B usage
Create an API client:
Python:
```python
import stytch
client = stytch.B2BClient(
project_id="project-live-c60c0abe-c25a-4472-a9ed-320c6667d317",
secret="secret-live-80JASucyk7z_G8Z-7dVwZVGXL5NT_qGAQ2I=",
# Optionally specify a custom base URL for all API calls
# custom_base_url="https://api.custom-domain.com/",
)
```
Create an organization
```python
response = client.organizations.create(
organization_name="Acme Co",
organization_slug="acme-co",
email_allowed_domains=["acme.co"]
)
```
Log the first user into the organization
```python
response = client.magic_links.email.login_or_signup(
organization_id="ORGANIZATION_ID_FROM_RESPONSE",
email_address="admin@acme.co",
login_redirect_url="https://example.com/authenticate",
signup_redirect_url="https://example.com/authenticate"
)
```
## Handling Errors
Structured errors from the Stytch API will raise `StytchError` exceptions. You can view the details of the error through
the `.details` property of the `StytchError` exception.
```python
from stytch.core.response_base import StytchError
try:
auth_resp = await client.magic_links.authenticate_async(token="token")
except StytchError as error:
# Handle Stytch errors here
if error.details.error_type == "invalid_token":
print("Whoops! Try again?")
except Exception as error:
# Handle other errors here
pass
```
Learn more about errors in the [docs](https://stytch.com/docs/api/errors).
## Documentation
See example requests and responses for all the endpoints in the [Stytch API Reference](https://stytch.com/docs/api).
Follow one of the [integration guides](https://stytch.com/docs/home#guides) or start with one of our [example apps](https://stytch.com/docs/home#example-apps).
## Support
If you've found a bug, [open an issue](https://github.com/stytchauth/stytch-python/issues/new)!
If you have questions or want help troubleshooting, join us in [Slack](https://stytch.com/docs/resources/support/overview) or email support@stytch.com.
If you've found a security vulnerability, please follow our [responsible disclosure instructions](https://stytch.com/docs/resources/security-and-trust/security#:~:text=Responsible%20disclosure%20program).
## Development
See [DEVELOPMENT.md](DEVELOPMENT.md)
## Code of Conduct
Everyone interacting in the Stytch project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](CODE_OF_CONDUCT.md).
نیازمندی
| مقدار | نام |
|---|---|
| - | aiohttp>=3.8.3 |
| - | requests>=2.7.0 |
| - | pydantic>=1.10.2 |
| - | pyjwt[crypto]>=2.9.0 |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.8 | Python |
نحوه نصب
نصب پکیج whl stytch-9.6.0:
pip install stytch-9.6.0.whl
نصب پکیج tar.gz stytch-9.6.0:
pip install stytch-9.6.0.tar.gz