File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,3 +55,44 @@ params: resend.Emails.SendParams = {
5555email: resend.Email = resend.Emails.send(params)
5656print (email)
5757```
58+
59+ ## Async Support
60+
61+ The SDK supports async operations for improved performance in async applications. To use async features, you need to install the async dependencies:
62+
63+ ``` bash
64+ pip install resend[async]
65+ ```
66+
67+ ### Async Example
68+
69+ ``` py
70+ import asyncio
71+ import os
72+ import resend
73+
74+ resend.api_key = " re_yourkey"
75+ # Set up async HTTP client
76+ resend.default_http_client = resend.HTTPXClient()
77+
78+ async def main ():
79+ params: resend.Emails.SendParams = {
80+ " from" : " onboarding@resend.dev" ,
81+ " to" : [" delivered@resend.dev" ],
82+ " subject" : " hi" ,
83+ " html" : " <strong>hello, world!</strong>" ,
84+ " reply_to" : " to@gmail.com" ,
85+ " bcc" : " bcc@resend.dev" ,
86+ " cc" : [" cc@resend.dev" ],
87+ " tags" : [
88+ {" name" : " tag1" , " value" : " tagvalue1" },
89+ {" name" : " tag2" , " value" : " tagvalue2" },
90+ ],
91+ }
92+
93+ email: resend.Email = await resend.Emails.send_async(params)
94+ print (email)
95+
96+ if __name__ == " __main__" :
97+ asyncio.run(main())
98+ ```
You can’t perform that action at this time.
0 commit comments