阅信短信验证码平台最近会从新梳理基于不同语言的短信接口调用代码示例,是为了迎合市面上现在流行的各个语言代码实现,也是为了能够更好的服务满足客户的不同层次的需求。下面的代码是基于python的短信接口调用代码示例模板,客户可拿来直接使用。
网址;http://www.jinloushiji.cn
- #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
来源: https://www.oschina.net/code/snippet_2849288_58726