azure.communication.sms package¶
-
class
azure.communication.sms.
SmsClient
(endpoint: str, credential: TokenCredential, **kwargs: Any)[source]¶ A client to interact with the AzureCommunicationService Sms gateway.
This client provides operations to send an SMS via a phone number.
- Parameters
endpoint (str) – The endpoint url for Azure Communication Service resource.
credential (TokenCredential) – The TokenCredential we use to authenticate against the service.
-
classmethod
from_connection_string
(conn_str: str, **kwargs: Any) → SmsClient[source]¶ Create SmsClient from a Connection String.
- Parameters
conn_str (str) – A connection string to an Azure Communication Service resource.
- Returns
Instance of SmsClient.
- Return type
SmsClient
Example:
-
class
azure.communication.sms.
SmsSendResult
(*, to: str, http_status_code: int, successful: bool, message_id: Optional[str] = None, error_message: Optional[str] = None, **kwargs)[source]¶ Response for a single recipient.
All required parameters must be populated in order to send to Azure.
- Parameters
to (str) – Required. The recipient’s phone number in E.164 format.
message_id (str) – The identifier of the outgoing Sms message. Only present if message processed.
http_status_code (int) – Required. HTTP Status code.
successful (bool) – Required. Indicates if the message is processed successfully or not.
error_message (str) – Optional error message in case of 4xx/5xx/repeatable errors.
-
as_dict
(keep_readonly=True, key_transformer=<function attribute_transformer>, **kwargs)¶ Return a dict that can be JSONify using json.dump.
Advanced usage might optionaly use a callback as parameter:
Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains ‘type’ with the msrest type and ‘key’ with the RestAPI encoded key. Value is the current value in this object.
The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.
See the three examples in this file:
attribute_transformer
full_restapi_key_transformer
last_restapi_key_transformer
If you want XML serialization, you can pass the kwargs is_xml=True.
- Parameters
key_transformer (function) – A key transformer function.
- Returns
A dict JSON compatible object
- Return type
-
classmethod
deserialize
(data, content_type=None)¶ Parse a str using the RestAPI syntax and return a model.
-
classmethod
enable_additional_properties_sending
()¶
-
classmethod
from_dict
(data, key_extractors=None, content_type=None)¶ Parse a dict using given key extractor return a model.
By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)
-
classmethod
is_xml_model
()¶
-
serialize
(keep_readonly=False, **kwargs)¶ Return the JSON that would be sent to azure from this model.
This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).
If you want XML serialization, you can pass the kwargs is_xml=True.