Registry / messaging / alibabacloud-dysmsapi20170525

alibabacloud-dysmsapi20170525

JSON →
library4.5.1pypypi✓ verified 84d ago

This is the Alibaba Cloud Dysmsapi (2017-05-25) SDK for Python, version 4.5.1. It allows developers to integrate SMS sending, querying, and management into Python applications using Alibaba Cloud's SMS service. The library is actively maintained with monthly releases.

pip install alibabacloud-dysmsapi20170525
INSTALL
IMPORT
SIG · ALIBABACLOUD-DYSMS
A
alibabacloud-dysmsapi20170525
messagingpythonv4.5.1
harness data pending
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)
Debug
Known issues
gotchaEndpoint must be set manually to 'dysmsapi.aliyuncs.com' in the config; automatic region resolution does not work for this service.
fix
Set config.endpoint = 'dysmsapi.aliyuncs.com' before creating the client.
affects: all
gotchaTemplateParam must be a JSON string (e.g., '{"code":"1234"}'), not a dict. Passing a dict will cause a validation error.
fix
Use json.dumps(your_dict) to convert to string.
affects: >=4.0.0
deprecatedThe use of access_key_id and access_key_secret directly in the config is deprecated in favor of credential chains (EnvironmentVariableCredentialsProvider, etc.).
fix
Use from alibabacloud_credentials.client import Client as CredClient and pass a credential client to the SDK.
affects: >=4.5.0
gotchaPhoneNumbers parameter must be a string of digits only (no '+', spaces, or dashes). International numbers should be prefixed with country code without '+', e.g., '8612345678901'.
fix
Pass phone numbers as plain digit strings.
affects: all
Errors
Common errors & fixes
AttributeError: module 'alibabacloud_dysmsapi20170525' has no attribute 'Client'
Importing Client from the top-level package instead of the client module.
fix
Use 'from alibabacloud_dysmsapi20170525.client import Client'
SDK.ServerUnreachable: Unable to connect to endpoint
Missing or incorrect endpoint configuration.
fix
Set '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.
fix
Convert 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.
fix
Verify 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
Agent activity
69 hits · last 30 days
node
60
OpenAI (training)
2
Resources
alibabacloud-dysmsapi20170525 — pip install alibabacloud-dysmsapi20170525 · libregistry