import uuid
import datetime
import hmac
import base64
import requests
from urllib.parse import urlencode, quote
class AliyunSMS(object):
def __init__(self, app):
self.app = app
self.format = app.config.get("ALIYUN_API_FORMAT") or "JSON"
self.version = "2016-09-27"
self.key = app.config["ALIYUN_API_KEY"]
self.secret = app.config["ALIYUN_API_SECRET"]
self.signature = ""
self.signature_method = "HMAC-SHA1"
self.signature_version = "1.0"
self.signature_nonce = str(uuid.uuid4())
self.timestamp = datetime.datetime.utcnow().isoformat("T")
self.region_id = app.config["ALIYUN_API_REGION_ID"]
self.gateway = app.config["ALISMS_GATEWAY"]
self.action = ""
self.sign = ""
self.template = ""
self.params = {}…
阿里云发送短信 python3实现
发布于