GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - resend/resend-python: Resend's official python sdk

BranchesTags
Open more actions menu

Latest commit

 

History

276 Commits
276 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
examples
examples
 
 
resend
resend
 
 
resources
resources
 
 
tests
tests
 
 
.flake8
.flake8
 
 
.gitignore
.gitignore
 
 
Dockerfile
Dockerfile
 
 
LICENSE.md
LICENSE.md
 
 
README.md
README.md
 
 
docker-compose.yaml
docker-compose.yaml
 
 
mypy.ini
mypy.ini
 
 
pytest.ini
pytest.ini
 
 
renovate.json
renovate.json
 
 
requirements-dev.txt
requirements-dev.txt
 
 
requirements.txt
requirements.txt
 
 
setup.py
setup.py
 
 
tox.ini
tox.ini
 
 

Repository files navigation

Resend Python SDK

Code style: black Build License: MIT PyPI PyPI - Python Version


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": "[email protected]",
    "to": ["[email protected]"],
    "subject": "hi",
    "html": "<strong>hello, world!</strong>",
    "reply_to": "[email protected]",
    "bcc": "[email protected]",
    "cc": ["[email protected]"],
    "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": "[email protected]",
        "to": ["[email protected]"],
        "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)

Legacy configurations that assign an AsyncHTTPClient to resend.default_http_client are also supported. Async requests select a client in this order:

  1. A replacement client assigned to resend.default_async_http_client.
  2. An AsyncHTTPClient assigned to resend.default_http_client.
  3. The automatic HTTPXClient, if httpx is installed.

Setting resend.default_async_http_client = None still permits the legacy fallback. Prefer the dedicated async setting for new code, so the sync client remains available for synchronous calls.

About

Resend's official python sdk

resend.com

Resources

Readme
MIT license
Activity
Custom properties

Stars

133 stars

Watchers

4 watching

Forks

24 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.