#!/usr/bin/env python # -*- coding:utf-8 -*- import hashlib import requests import hmac import base64 import datetime import tempfile import shutil,os class aliyun: def __init__(self): self.__aliyun_id = "" # 个人用户 id self.__aliyun_secret = "" # 个人用户 secret def __time(self): time = datetime.datetime.strftime(datetime.datetime.utcnow(), "%a, %d %b %Y %H:%M:%S GMT") return date def __md5_base64(self, body): hash = hashlib.md5() hash.update(body) str_hex = hash.digest() return base64.b64encode(str_hex) def __sha1_base64(self, str_to_sign, secret): hmacsha1 = hmac.new(secret.encode('utf-8'), str_to_sign.encode('utf-8'), hashlib.sha1) return base64.b64encode(hmacsha1.digest()).decode('utf-8') def send_request(self, phrase): options = {'method': 'POST', '
python 调用阿里云语音合成TTS
最新推荐文章于 2025-04-18 21:49:05 发布