Registry /
messaging / alibabacloud-dysmsapi20170525
Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Client
✓ from alibabacloud_dysmsapi20170525.client import Client
✗ from alibabacloud_dysmsapi20170525 import Client
Client is not a top-level export; must import from client module
SendSmsRequest
✓ from alibabacloud_dysmsapi20170525.models import SendSmsRequest
✗ from alibabacloud_dysmsapi20170525 import SendSmsRequest
Request models are in models module
SendSmsResponse
✓ from alibabacloud_dysmsapi20170525.models import SendSmsResponse
Response models also in models module
Sends an SMS using Alibaba Cloud Dysmsapi.
import os
from alibabacloud_dysmsapi20170525.client import Client
from alibabacloud_dysmsapi20170525 import models
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_credentials.client import Client as CredClient
config = open_api_models.Config(
access_key_id=os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_ID', ''),
access_key_secret=os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_SECRET', '')
)
config.endpoint = 'dysmsapi.aliyuncs.com'
client = Client(config)
send_request = models.SendSmsRequest(
phone_numbers='12345678901',
sign_name='YourSign',
template_code='SMS_123456',
template_param='{"code":"1234"}'
)
response = client.send_sms(send_request)
print(response.body.message)
Errors
Common errors & fixes
AttributeError: module 'alibabacloud_dysmsapi20170525' has no attribute 'Client'
Importing Client from the top-level package instead of the client module.
fixUse 'from alibabacloud_dysmsapi20170525.client import Client'
SDK.ServerUnreachable: Unable to connect to endpoint
Missing or incorrect endpoint configuration.
fixSet 'config.endpoint = 'dysmsapi.aliyuncs.com'' before creating the client.
InvalidParameter: The specified parameter "TemplateParam" is not valid.
TemplateParam must be a JSON string, not a Python dict.
fixConvert the dict to a JSON string using json.dumps().
SignatureDoesNotMatch: The request signature we calculated does not match the signature you provided.
Invalid or expired AccessKey credentials.
fixVerify ALIBABA_CLOUD_ACCESS_KEY_ID and ALIBABA_CLOUD_ACCESS_KEY_SECRET environment variables are set correctly.
Upgrade
Version history
4.5.1latest on PyPI · released Apr 7, 2026
Audit
Dependencies
alibabacloud-tea-openapirequiredCore OpenAPI client dependency
alibabacloud-credentialsrequiredCredential management