aiosendgrid-0.1.0
توضیحات
Async SendGrid client based on httpx
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | aiosendgrid-0.1.0 |
| نام | aiosendgrid |
| نسخه کتابخانه | 0.1.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Thomas BERDY |
| ایمیل نویسنده | thomas.berdy@outlook.com |
| آدرس صفحه اصلی | https://github.com/kozlek/aiosendgrid |
| آدرس اینترنتی | https://pypi.org/project/aiosendgrid/ |
| مجوز | - |
# aiosendgrid
A simple SendGrid asynchronous client based on [httpx](https://github.com/encode/httpx).
# Installation
```bash
pip install aiosendgrid
```
Or, to include the optional SendGrid helpers support, use:
```bash
pip install aiosendgrid[helpers]
```
# Usage
## With Mail Helper Class
```python
import aiosendgrid
from sendgrid.helpers.mail import Content, Email, Mail, To
SENDGRID_API_KEY = "SG.XXX"
from_email = Email("test@example.com")
to_email = To("test@example.com")
subject = "Sending with SendGrid is Fun"
content = Content("text/plain", "and easy to do anywhere, even with Python")
mail = Mail(from_email, to_email, subject, content)
async with aiosendgrid.AsyncSendGridClient(api_key=SENDGRID_API_KEY) as client:
response = await client.send_mail_v3(body=mail.get())
```
More info on [sendgrid-python](https://github.com/sendgrid/sendgrid-python) official repository.
## Without Mail Helper Class
```python
import aiosendgrid
SENDGRID_API_KEY = "SG.XXX"
data = {
"personalizations": [
{
"to": [{"email": "test@example.com"}],
"subject": "Sending with SendGrid is Fun",
}
],
"from": {"email": "test@example.com"},
"content": [
{"type": "text/plain", "value": "and easy to do anywhere, even with Python"}
],
}
async with aiosendgrid.AsyncSendGridClient(api_key=SENDGRID_API_KEY) as client:
response = await client.send_mail_v3(body=data)
```
نیازمندی
| مقدار | نام |
|---|---|
| >=0.22.0 | httpx[http2] |
| >=6.9.6) | sendgrid |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.9,<4.0 | Python |
نحوه نصب
نصب پکیج whl aiosendgrid-0.1.0:
pip install aiosendgrid-0.1.0.whl
نصب پکیج tar.gz aiosendgrid-0.1.0:
pip install aiosendgrid-0.1.0.tar.gz