微信掃一掃
認(rèn)證、簽名模板審核結(jié)果通知
賬號(hào)短信余額不足提醒
平臺(tái)促銷活動(dòng)及最新資訊
秒賽為開發(fā)者提供了詳細(xì)的API文檔和代碼示例,幫助開發(fā)者快速接入短信平臺(tái)
#!/usr/bin/env python # -*- coding: utf-8 -*- import requests import json import hashlib import time class SendCode: def send( self ,account,pswd,mobile,msg,ts,state): url = 'http://139.196.108.241:8080' + { 1 : '/Api/HttpSendSMYzm.ashx' , 2 : '/Api/HttpSendSMYx.ashx' , 3 : '/Api/HttpSendSMVoice.ashx' }[state]; if ts! = "" : m = hashlib.md5() strs = account + pswd + str (ts) m.update(strs.encode( "utf8" )) pswd = m.hexdigest() body = { "account" : account, "pswd" : pswd, "mobile" : mobile, "msg" :msg, "ts" : str (ts)} header_dict = { 'User-Agent' : 'Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko' , "Content-Type" : "application/x-www-form-urlencoded" } response = requests.post(url, data = body,headers = header_dict) return json.loads( response.text) # account 用戶賬號(hào) # pswd 必填參數(shù)。用戶密碼 # mobile 必填參數(shù)。合法的手機(jī)號(hào)碼 # msg 必填參數(shù)。短信內(nèi)容 # ts 可選參數(shù),時(shí)間戳,格式y(tǒng)yyyMMddHHmmss # state 必填參數(shù) 狀態(tài) 1:驗(yàn)證碼短信 2:營銷短信 3:語音驗(yàn)證碼 send = SendCode() res = send.send( '您的賬號(hào)' , '您的密碼' , '手機(jī)號(hào)' , '短信內(nèi)容' , ( int (time.time())), 1 ) # print(res['result']) |
認(rèn)證、簽名模板審核結(jié)果通知
賬號(hào)短信余額不足提醒
平臺(tái)促銷活動(dòng)及最新資訊