https://github.com/resend/resend-python
resend's python sdk
https://github.com/resend/resend-python
Last synced: 2 months ago
JSON representation
resend's python sdk
- Host: GitHub
- URL: https://github.com/resend/resend-python
- Owner: resend
- License: mit
- Created: 2022-12-06T17:58:04.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-03-25T03:04:11.000Z (about 1 year ago)
- Last Synced: 2025-04-06T00:33:11.217Z (about 1 year ago)
- Language: Python
- Homepage:
- Size: 179 KB
- Stars: 78
- Watchers: 3
- Forks: 8
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Resend Python SDK
[](https://github.com/psf/black)

[](https://codecov.io/gh/drish/resend-py)
[](https://opensource.org/licenses/MIT)
[](https://pypi.org/project/resend/)
[](https://pypi.org/project/resend)
---
## Installation
To install Resend Python SDK, simply execute the following command in a terminal:
```
pip install resend
```
## Setup
First, you need to get an API key, which is available in the [Resend Dashboard](https://resend.com).
```py
import resend
import os
resend.api_key = "re_yourkey"
```
## Example
You can get an overview about all parameters in the [Send Email](https://resend.com/docs/api-reference/emails/send-email) API reference.
```py
import os
import resend
resend.api_key = "re_yourkey"
params: resend.Emails.SendParams = {
"from": "onboarding@resend.dev",
"to": ["delivered@resend.dev"],
"subject": "hi",
"html": "hello, world!",
"reply_to": "to@gmail.com",
"bcc": "bcc@resend.dev",
"cc": ["cc@resend.dev"],
"tags": [
{"name": "tag1", "value": "tagvalue1"},
{"name": "tag2", "value": "tagvalue2"},
],
}
email: resend.Emails.SendResponse = resend.Emails.send(params)
print(email)
```
## Async Support
The SDK supports async operations via `httpx`. Install the async extra:
```bash
pip install resend[async]
```
Once installed, async methods (suffixed with `_async`) work automatically — no extra setup needed:
```py
import asyncio
import resend
resend.api_key = "re_yourkey"
async def main():
params: resend.Emails.SendParams = {
"from": "onboarding@resend.dev",
"to": ["delivered@resend.dev"],
"subject": "hi",
"html": "hello, world!",
}
email: resend.Emails.SendResponse = await resend.Emails.send_async(params)
print(email)
if __name__ == "__main__":
asyncio.run(main())
```
### Custom async client
To use a custom async HTTP client or configure options like timeouts, set `resend.default_async_http_client`:
```py
import resend
resend.api_key = "re_yourkey"
resend.default_async_http_client = resend.HTTPXClient(timeout=60)
```