SendgridClient
Attributes
Classes
AddGlobalSuppressRequestAndResponse
dataclass
GetGlobalSuppressResponse
dataclass
ObjectEntity
dataclass
EmailIsUnsubscribedResponse
dataclass
RecipientLists
dataclass
Recipients
dataclass
EmailResponse
dataclass
GetGlobalSuppressEmptyResponse
dataclass
EmailRequest
dataclass
EmailRequest(from_: str, to: str, subject: str, text: str, ishtml: bool, *, attachments: Optional[List[EmailAttachment | Mapping[str, Any]]] = None, fromname: Optional[str] = None, toname: Optional[str] = None, cc: Optional[str] = None, ccname: Optional[str] = None, bcc: Optional[str] = None, bccname: Optional[str] = None)
Definition: EmailRequest
Attributes
attachments
class-attribute
instance-attribute
attachments: Optional[List[EmailAttachment | Mapping[str, Any]]] = dataclass_field(default=None, kw_only=True)
Attachments
from_
class-attribute
instance-attribute
Origination address of your email. Must be a valid email address from your domain
fromname
class-attribute
instance-attribute
Origination name of your email
toname
class-attribute
instance-attribute
A display name for each email address separated by a semicolon or comma
ishtml
instance-attribute
Specify whether the content of the email is HTML or plain text
cc
class-attribute
instance-attribute
Valid email addresses separated by a semicolon or comma
ccname
class-attribute
instance-attribute
A display name for each CC email address separated by a semicolon or comma
bcc
class-attribute
instance-attribute
Valid email addresses separated by a semicolon or comma
EmailAttachment
dataclass
EmailAttachment(*, content: Optional[str] = None, filename: Optional[str] = None, contenttype: Optional[str] = None)
Definition: EmailAttachment
Attributes
content
class-attribute
instance-attribute
Attachment file content
filename
class-attribute
instance-attribute
Attachment file name
RecipientList
dataclass
RecipientList(*, id: Optional[int] = None, name: Optional[str] = None, recipient_count: Optional[int] = None)
Definition: RecipientList
Attributes
id
class-attribute
instance-attribute
Unique list id
name
class-attribute
instance-attribute
Name
Recipient
dataclass
Recipient(*, email: Optional[str] = None, last_name: Optional[str] = None, first_name: Optional[str] = None, id: Optional[str] = None)
Definition: Recipient
Attributes
email
class-attribute
instance-attribute
Email address
last_name
class-attribute
instance-attribute
Last name
first_name
class-attribute
instance-attribute
First name
ScopeList
dataclass
Bounce
dataclass
Bounce(*, created: Optional[int] = None, email: Optional[str] = None, reason: Optional[str] = None, status: Optional[str] = None)
Definition: Bounce
Attributes
created
class-attribute
instance-attribute
Created
email
class-attribute
instance-attribute
reason
class-attribute
instance-attribute
Reason
SendgridClient
SendgridClient(connection_runtime_url: str, credential: AsyncTokenCredential | AzureKeyCredential, *, max_retry_attempts: int = 3, timeout: float = 30.0, use_exponential_backoff: bool = True, initial_retry_delay_seconds: float = 0.5, maximum_retry_delay_seconds: float = 120.0, retry_jitter_factor: float = 0.1, retry_unsafe_http_methods: bool = False, transport: Optional[AsyncHttpTransport] = None, **kwargs: Any)
Bases: ConnectorClientBase
Typed client for sendgrid connector.
Initialize a SendgridClient.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
connection_runtime_url
|
str
|
The connection runtime URL from Azure Portal. |
required |
credential
|
AsyncTokenCredential | AzureKeyCredential
|
Caller-owned Azure Core credential. |
required |
max_retry_attempts
|
int
|
The maximum number of request attempts. |
3
|
timeout
|
float
|
The network timeout in seconds for each request. The value configures Azure Core retry and transport deadlines. Nonpositive values disable SDK and transport deadlines. |
30.0
|
use_exponential_backoff
|
bool
|
Whether retries use exponential backoff. |
True
|
initial_retry_delay_seconds
|
float
|
The initial retry delay in seconds. |
0.5
|
maximum_retry_delay_seconds
|
float
|
The maximum retry delay in seconds. |
120.0
|
retry_jitter_factor
|
float
|
The jitter fraction applied to retry delays. |
0.1
|
retry_unsafe_http_methods
|
bool
|
Whether unsafe HTTP methods may be retried. |
False
|
transport
|
Optional[AsyncHttpTransport]
|
Optional Azure Core async HTTP transport closed by the client through its asynchronous lifecycle. |
None
|
**kwargs
|
Any
|
Optional Azure Core pipeline policy settings. |
{}
|
Methods:
add_global_suppression
async
add_global_suppression(input: AddGlobalSuppressRequestAndResponse | Mapping[str, Any], *, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> dict[str, Any] | None
Add a global suppression
Add a global suppression
Swagger operation ID: AddGlobalSuppression.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
AddGlobalSuppressRequestAndResponse | Mapping[str, Any]
|
The request body. Mapping keys use serialized Swagger wire names. |
required |
timeout
|
Optional[float]
|
The request timeout in seconds. |
None
|
headers
|
Optional[Mapping[str, str]]
|
Additional HTTP request headers. |
None
|
client_request_id
|
Optional[str]
|
A caller-provided request identifier. |
None
|
response_hook
|
Optional[ConnectorResponseHook]
|
A callback invoked with the connector response. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any] | None
|
dict[str, Any] | None: The connector operation result. |
Raises:
| Type | Description |
|---|---|
ConnectorException
|
If the connector request fails. |
get_global_suppression
async
get_global_suppression(email: str, *, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> dict[str, Any] | None
Get the global suppression
Get the global suppression
Swagger operation ID: GetGlobalSuppression.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
email
|
str
|
The email to check. |
required |
timeout
|
Optional[float]
|
The request timeout in seconds. |
None
|
headers
|
Optional[Mapping[str, str]]
|
Additional HTTP request headers. |
None
|
client_request_id
|
Optional[str]
|
A caller-provided request identifier. |
None
|
response_hook
|
Optional[ConnectorResponseHook]
|
A callback invoked with the connector response. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any] | None
|
dict[str, Any] | None: The connector operation result. |
Raises:
| Type | Description |
|---|---|
ConnectorException
|
If the connector request fails. |
delete_global_suppression
async
delete_global_suppression(email: str, *, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> None
Delete the global suppression
Delete the global suppression
Swagger operation ID: DeleteGlobalSuppression.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
email
|
str
|
The email to delete. |
required |
timeout
|
Optional[float]
|
The request timeout in seconds. |
None
|
headers
|
Optional[Mapping[str, str]]
|
Additional HTTP request headers. |
None
|
client_request_id
|
Optional[str]
|
A caller-provided request identifier. |
None
|
response_hook
|
Optional[ConnectorResponseHook]
|
A callback invoked with the connector response. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
The operation completes without a response body. |
Raises:
| Type | Description |
|---|---|
ConnectorException
|
If the connector request fails. |
add_recipient_to_list
async
add_recipient_to_list(list_id: str, recipient_id: str, *, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> dict[str, Any] | None
Add recipient to list
Add an individual recipient to a recipient list.
Swagger operation ID: AddRecipientToList.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
list_id
|
str
|
Unique id of the recipient list. |
required |
recipient_id
|
str
|
Unique id of the recipient. |
required |
timeout
|
Optional[float]
|
The request timeout in seconds. |
None
|
headers
|
Optional[Mapping[str, str]]
|
Additional HTTP request headers. |
None
|
client_request_id
|
Optional[str]
|
A caller-provided request identifier. |
None
|
response_hook
|
Optional[ConnectorResponseHook]
|
A callback invoked with the connector response. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any] | None
|
dict[str, Any] | None: The connector operation result. |
Raises:
| Type | Description |
|---|---|
ConnectorException
|
If the connector request fails. |
list_bounce
list_bounce(email: str, *, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> AsyncItemPaged[dict[str, Any]]
Get bounce for an email
Get a specific bounce for a given email address.
Returns a single-page Azure Core async collection.
Swagger operation ID: GetBounce.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
email
|
str
|
The email to check. |
required |
timeout
|
Optional[float]
|
The request timeout in seconds. |
None
|
headers
|
Optional[Mapping[str, str]]
|
Additional HTTP request headers. |
None
|
client_request_id
|
Optional[str]
|
A caller-provided request identifier. |
None
|
response_hook
|
Optional[ConnectorResponseHook]
|
A callback invoked with the connector response. |
None
|
Returns:
| Type | Description |
|---|---|
AsyncItemPaged[dict[str, Any]]
|
AsyncItemPaged[dict[str, Any]]: An Azure Core pager over connector
results. Consume it with |
Raises:
| Type | Description |
|---|---|
ConnectorException
|
If the connector request fails. |
delete_bounce
async
delete_bounce(email: str, *, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> None
Delete an email from bounce list
Delete an email address from your bounce list.
Swagger operation ID: DeleteBounce.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
email
|
str
|
The email to delete. |
required |
timeout
|
Optional[float]
|
The request timeout in seconds. |
None
|
headers
|
Optional[Mapping[str, str]]
|
Additional HTTP request headers. |
None
|
client_request_id
|
Optional[str]
|
A caller-provided request identifier. |
None
|
response_hook
|
Optional[ConnectorResponseHook]
|
A callback invoked with the connector response. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
The operation completes without a response body. |
Raises:
| Type | Description |
|---|---|
ConnectorException
|
If the connector request fails. |
check_email_is_in_unsubscribes_list
async
check_email_is_in_unsubscribes_list(email: str, *, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> dict[str, Any] | None
Check if email is in unsubscribed email list
Check if email is in unsubscribed email list.
Swagger operation ID: CheckEmailIsInUnsubscribesList.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
email
|
str
|
The email to check. |
required |
timeout
|
Optional[float]
|
The request timeout in seconds. |
None
|
headers
|
Optional[Mapping[str, str]]
|
Additional HTTP request headers. |
None
|
client_request_id
|
Optional[str]
|
A caller-provided request identifier. |
None
|
response_hook
|
Optional[ConnectorResponseHook]
|
A callback invoked with the connector response. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any] | None
|
dict[str, Any] | None: The connector operation result. |
Raises:
| Type | Description |
|---|---|
ConnectorException
|
If the connector request fails. |
send_email
async
send_email(input: EmailRequest | Mapping[str, Any], *, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> dict[str, Any] | None
Send email
Sends an email (V4). Limited to 1000 recipients.
Swagger operation ID: SendEmailV4.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
EmailRequest | Mapping[str, Any]
|
The request body. Mapping keys use serialized Swagger wire names. |
required |
timeout
|
Optional[float]
|
The request timeout in seconds. |
None
|
headers
|
Optional[Mapping[str, str]]
|
Additional HTTP request headers. |
None
|
client_request_id
|
Optional[str]
|
A caller-provided request identifier. |
None
|
response_hook
|
Optional[ConnectorResponseHook]
|
A callback invoked with the connector response. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, Any] | None
|
dict[str, Any] | None: The connector operation result. |
Raises:
| Type | Description |
|---|---|
ConnectorException
|
If the connector request fails. |
list_recipient_lists
list_recipient_lists(*, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> AsyncItemPaged[dict[str, Any]]
List Recipient Lists
Retrieves all the recipient lists.
Returns a single-page Azure Core async collection.
Swagger operation ID: ListRecipientLists.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
Optional[float]
|
The request timeout in seconds. |
None
|
headers
|
Optional[Mapping[str, str]]
|
Additional HTTP request headers. |
None
|
client_request_id
|
Optional[str]
|
A caller-provided request identifier. |
None
|
response_hook
|
Optional[ConnectorResponseHook]
|
A callback invoked with the connector response. |
None
|
Returns:
| Type | Description |
|---|---|
AsyncItemPaged[dict[str, Any]]
|
AsyncItemPaged[dict[str, Any]]: An Azure Core pager over connector
results. Consume it with |
Raises:
| Type | Description |
|---|---|
ConnectorException
|
If the connector request fails. |
list_recipients
list_recipients(*, timeout: Optional[float] = None, headers: Optional[Mapping[str, str]] = None, client_request_id: Optional[str] = None, response_hook: Optional[ConnectorResponseHook] = None) -> AsyncItemPaged[dict[str, Any]]
List Recipients
Retrieves all registered recipients.
Returns a single-page Azure Core async collection.
Swagger operation ID: ListRecipients.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
Optional[float]
|
The request timeout in seconds. |
None
|
headers
|
Optional[Mapping[str, str]]
|
Additional HTTP request headers. |
None
|
client_request_id
|
Optional[str]
|
A caller-provided request identifier. |
None
|
response_hook
|
Optional[ConnectorResponseHook]
|
A callback invoked with the connector response. |
None
|
Returns:
| Type | Description |
|---|---|
AsyncItemPaged[dict[str, Any]]
|
AsyncItemPaged[dict[str, Any]]: An Azure Core pager over connector
results. Consume it with |
Raises:
| Type | Description |
|---|---|
ConnectorException
|
If the connector request fails. |