All Products
Document Center

:Python SDK

Last Updated:Apr 13, 2023

This topic provides a comprehensive guide on how to utilize Alibaba Cloud SMS SDK for Python. By incorporating this SDK as a dependency in your application, you can easily integrate the SendMessageToGlobe operation, enabling you to send SMS messages to various regions around the world, excluding the Chinese mainland.

Usage notes

  • When you construct the AcsClient object, you must use the default value of the regionId parameter. The default value is ap-southeast-1. Note that regionId is the third parameter when you construct the AcsClient object.

  • You must use the default domain name:

  • You must use the default API version number: 2018-05-01.

Sample code

#!/usr/bin/env python
import os
from aliyunsdkcore.client import AcsClient
from aliyunsdkcore.request import CommonRequest
client = AcsClient('<accessKeyId>', '<accessSecret>', 'ap-southeast-1')
request = CommonRequest()
request.add_query_param('To', '62813****7451')
request.add_query_param('From', '1234')
request.add_query_param('Message', 'Have a test.')
response = client.do_action(request)
# python2: print(response) 
print(str(response, encoding = 'utf-8'))