國(guó)際驗(yàn)證碼接口供應(yīng)商:如何獲取國(guó)際短信驗(yàn)證碼?
2020-11-04 00:00:00
來(lái)源:http://www.yzdtdq.net.cn/
點(diǎn)擊:3331
喜歡:0
國(guó)際驗(yàn)證碼接口供應(yīng)商:如何獲取國(guó)際短信驗(yàn)證碼? #!/usr/local/bin/python #-*-coding:utf-8-*- #Author:jacky #Time:14-2-22下午11:48 #Desc:短信http接口的python代碼調(diào)用示例 import httplib import urllib import json #服務(wù)地址 host="intapi.xxxxxxxxx.com" #端口號(hào) port=80 #版本號(hào) version="v1.1" #查賬戶信息的URI balance_get_uri="/balance/json" #智能匹配模版短信接口的URI

sms_send_uri="/send/json" #,xxxx賬號(hào) account="" #,xxxx密碼 password="" def get_user_balance(): """ 取賬戶余額 """ params={'account':account,'password':password} params=json.dumps(params) headers={"Content-type":"application/json"} conn=httplib.HTTPConnection(host,port=port) conn.request('POST',balance_get_uri,params,headers) response=conn.getresponse() response_str=response.read() conn.close() return response_str 云通訊平臺(tái)---國(guó)際短信接口調(diào)用demo def send_sms(text,phone): """ 能用接口發(fā)短信 """ params={'account':account,'password':password,'msg':urllib.quote(text),'mobile':phone,'report':'false'} params=json.dumps(params) headers={"Content-type":"application/json"} conn=httplib.HTTPConnection(host,port=port,timeout=30) conn.request("POST",sms_send_uri,params,headers) response=conn.getresponse() response_str=response.read() conn.close() return response_str if __name__=='__main__': #手機(jī)號(hào)碼,格式(區(qū)號(hào)+手機(jī)號(hào)碼),例如:8615800000000,其中86為中國(guó)的區(qū)號(hào) phone="8615800000000" text="xxxxx您的驗(yàn)證碼是1234" #查賬戶余額 print(get_user_balance()) #調(diào)用智能匹配模版接口發(fā)短信 print(send_sms(text,phone)) 【鄭州嘉之元計(jì)算機(jī)科技有限公司】專(zhuān)業(yè)提供短信群發(fā)平臺(tái),短信驗(yàn)證碼,106短信平臺(tái),短信接口,國(guó)際短信,物聯(lián)網(wǎng)等云通訊服務(wù),是優(yōu)質(zhì)的短信平臺(tái)服務(wù)商.
上一篇:短信群發(fā):雙十一營(yíng)銷(xiāo)短信的熱潮你趕上了嗎?
下一篇:106短信群發(fā)平臺(tái)短信多少錢(qián)一條?