基于python的短信接口调用代码示例模板

作者在 2016-08-24 16:39:09 发布以下内容

阅信短信验证码平台最近会从新梳理基于不同语言的短信接口调用代码示例,是为了迎合市面上现在流行的各个语言代码实现,也是为了能够更好的服务满足客户的不同层次的需求。

         下面的代码是基于python的短信接口调用代码示例模板,客户可拿来直接使用。

#coding=utf-8

import urllib

import urllib2

import time

import hashlib

 

 

def md5(str):

    import hashlib

m = hashlib.md5()  

m.update(str)

returnm.hexdigest()

 

url = 'http://183.203.28.226:9000/HttpSmsMt'

timenew= time.strftime("%Y%m%d%H%M%S", time.localtime(time.time()))

pwd = md5('**********'+timenew)

values = {'name':'syncs','pwd':pwd,'content':'【阅信短信平台】验证码888888,千万不能告诉别人哦。','phone':'13381272353','subid':'','mttime':timenew}

data = urllib.urlencode(values)

req = urllib2.Request(url, data)

response = urllib2.urlopen(req)

the_page = response.read()

print the_page

 

默认分类 | 阅读 2490 次
文章评论,共0条
游客请输入验证码
文章分类
文章归档
最新评论