Resend Python SDK
Project description
Resend Python SDK
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.
import resend
import os
resend.api_key = "re_yourkey"
Example
You can get an overview about all parameters in the Send Email API reference.
import os
import resend
resend.api_key = "re_yourkey"
params: resend.Emails.SendParams = {
"from": "onboarding@resend.dev",
"to": ["delivered@resend.dev"],
"subject": "hi",
"html": "<strong>hello, world!</strong>",
"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:
pip install resend[async]
Once installed, async methods (suffixed with _async) work automatically — no extra setup needed:
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": "<strong>hello, world!</strong>",
}
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:
import resend
resend.api_key = "re_yourkey"
resend.default_async_http_client = resend.HTTPXClient(timeout=60)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file resend-2.27.0.tar.gz.
File metadata
- Download URL: resend-2.27.0.tar.gz
- Upload date:
- Size: 37.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abc183da7566c1fdba8221ec5acd9f954c2ff516a0c2615bee2a41bc9db3e277
|
|
| MD5 |
86ed9efc5d3e9eab1b4d339d1f32e9c5
|
|
| BLAKE2b-256 |
96da3d342cacbde7143e36782243caa3715d9e49cadb43e804419493c784869b
|
File details
Details for the file resend-2.27.0-py2.py3-none-any.whl.
File metadata
- Download URL: resend-2.27.0-py2.py3-none-any.whl
- Upload date:
- Size: 59.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5bc8ddebb0418127fc3e47eb29ab72af727861481c4b051b96cb693df8f8dc40
|
|
| MD5 |
0053490a5044eead6dfb51cbbfb1eee5
|
|
| BLAKE2b-256 |
b495783b09d24c8f40b900a2728b67fd3c1401d4a6afcdf1db1c8475c249559d
|