sendgrid-async 2.0.0__tar.gz → 2.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sendgrid_async-2.0.0 → sendgrid_async-2.0.2}/PKG-INFO +14 -9
- {sendgrid_async-2.0.0 → sendgrid_async-2.0.2}/README.md +14 -8
- sendgrid_async-2.0.2/async_sendgrid/__init__.py +4 -0
- {sendgrid_async-2.0.0 → sendgrid_async-2.0.2}/pyproject.toml +4 -1
- sendgrid_async-2.0.0/async_sendgrid/__init__.py +0 -9
- {sendgrid_async-2.0.0 → sendgrid_async-2.0.2}/LICENSE +0 -0
- {sendgrid_async-2.0.0 → sendgrid_async-2.0.2}/async_sendgrid/sendgrid.py +0 -0
- {sendgrid_async-2.0.0 → sendgrid_async-2.0.2}/async_sendgrid/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: sendgrid-async
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.2
|
|
4
4
|
Summary: SendGrid using a client based on httpx.
|
|
5
5
|
Home-page: https://github.com/EM51641/async-sendgrid/
|
|
6
6
|
License: MIT
|
|
@@ -29,30 +29,31 @@ Description-Content-Type: text/markdown
|
|
|
29
29
|
|
|
30
30
|
# Async-Sendgrid
|
|
31
31
|
|
|
32
|
-
Sendgrid simple asynchronous client
|
|
32
|
+
Sendgrid-Async is a simple asynchronous client built upon the httpx library.
|
|
33
33
|
|
|
34
34
|
# Installation
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
You can install Sendgrid-Async using pip with the following command:
|
|
37
37
|
|
|
38
38
|
```shell
|
|
39
39
|
pip install sendgrid-async
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
# Usage
|
|
43
|
-
This is a small script showing how to send an email with async-sendgrid:
|
|
44
43
|
|
|
45
|
-
|
|
44
|
+
Here is a brief script demonstrating how to send an email using Async-Sendgrid:
|
|
45
|
+
|
|
46
|
+
First, import the `SendgridAPI` from the `sendgrid-async` package. Then, create a SendgridAPI object using your API key.
|
|
46
47
|
|
|
47
48
|
```python
|
|
48
49
|
from async_sendgrid import SendgridAPI
|
|
49
50
|
import os
|
|
50
51
|
|
|
51
|
-
API_KEY = os.environ.get('
|
|
52
|
+
API_KEY = os.environ.get('SECRET_API_KEY')
|
|
52
53
|
sendgrid = SendgridAPI(API_KEY)
|
|
53
54
|
```
|
|
54
55
|
|
|
55
|
-
|
|
56
|
+
Next, we can create an email using the original `sendgrid` library as follows:
|
|
56
57
|
|
|
57
58
|
```python
|
|
58
59
|
from sendgrid.helpers.mail import Content, Email, Mail, To
|
|
@@ -68,13 +69,17 @@ mail = Mail(
|
|
|
68
69
|
subject=subject,
|
|
69
70
|
content=content
|
|
70
71
|
)
|
|
71
|
-
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
An email can be sent to sendgrid servers with the `send` API of the `SendgridAPI` instance:
|
|
75
75
|
|
|
76
76
|
```python
|
|
77
77
|
async with sendgrid as client:
|
|
78
78
|
response = await client.send(data)
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
+
For testing purposes, you can modify the API endpoint as follows:
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
sendgrid = SendgridAPI(api_key="SECRET_API_KEY", endpoint="https://localhost:3000/v3/mail/send")
|
|
85
|
+
```
|
|
@@ -6,30 +6,31 @@
|
|
|
6
6
|
|
|
7
7
|
# Async-Sendgrid
|
|
8
8
|
|
|
9
|
-
Sendgrid simple asynchronous client
|
|
9
|
+
Sendgrid-Async is a simple asynchronous client built upon the httpx library.
|
|
10
10
|
|
|
11
11
|
# Installation
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
You can install Sendgrid-Async using pip with the following command:
|
|
14
14
|
|
|
15
15
|
```shell
|
|
16
16
|
pip install sendgrid-async
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
# Usage
|
|
20
|
-
This is a small script showing how to send an email with async-sendgrid:
|
|
21
20
|
|
|
22
|
-
|
|
21
|
+
Here is a brief script demonstrating how to send an email using Async-Sendgrid:
|
|
22
|
+
|
|
23
|
+
First, import the `SendgridAPI` from the `sendgrid-async` package. Then, create a SendgridAPI object using your API key.
|
|
23
24
|
|
|
24
25
|
```python
|
|
25
26
|
from async_sendgrid import SendgridAPI
|
|
26
27
|
import os
|
|
27
28
|
|
|
28
|
-
API_KEY = os.environ.get('
|
|
29
|
+
API_KEY = os.environ.get('SECRET_API_KEY')
|
|
29
30
|
sendgrid = SendgridAPI(API_KEY)
|
|
30
31
|
```
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
Next, we can create an email using the original `sendgrid` library as follows:
|
|
33
34
|
|
|
34
35
|
```python
|
|
35
36
|
from sendgrid.helpers.mail import Content, Email, Mail, To
|
|
@@ -45,12 +46,17 @@ mail = Mail(
|
|
|
45
46
|
subject=subject,
|
|
46
47
|
content=content
|
|
47
48
|
)
|
|
48
|
-
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
An email can be sent to sendgrid servers with the `send` API of the `SendgridAPI` instance:
|
|
52
52
|
|
|
53
53
|
```python
|
|
54
54
|
async with sendgrid as client:
|
|
55
55
|
response = await client.send(data)
|
|
56
56
|
```
|
|
57
|
+
|
|
58
|
+
For testing purposes, you can modify the API endpoint as follows:
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
sendgrid = SendgridAPI(api_key="SECRET_API_KEY", endpoint="https://localhost:3000/v3/mail/send")
|
|
62
|
+
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "sendgrid-async"
|
|
3
|
-
version = "2.0.
|
|
3
|
+
version = "2.0.2"
|
|
4
4
|
description = "SendGrid using a client based on httpx."
|
|
5
5
|
license = "MIT"
|
|
6
6
|
authors = ["Elyes Mahjoubo <elyesmahjoubi@gmail.com>"]
|
|
@@ -36,6 +36,9 @@ flake8 = "^6.0.0"
|
|
|
36
36
|
black = "^23.9.0"
|
|
37
37
|
tox = "^4.11.1"
|
|
38
38
|
|
|
39
|
+
[tool.poetry.group.dev.dependencies]
|
|
40
|
+
ipykernel = "^6.29.4"
|
|
41
|
+
|
|
39
42
|
[tool.black]
|
|
40
43
|
line-length = 79
|
|
41
44
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|