您的位置:首页 > 编程语言 > Python开发

6.4 Python版本的短信接口示例代码

2017-04-25 00:00 323 查看
#coding=utf-8

import urllib

import urllib2

import time

import hashlib

def md5(str):

import hashlib

m = hashlib.md5()

m.update(str)

return m.hexdigest()

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

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

pwd = md5(密码+timenew)

values = {'name':用户名,'pwd':pwd,'content':'【阅信】验证码888888。

','phone':'13400000000','subid':'','mttime':timenew}

# values = {'name':用户名,'pwd':pwd,'content':'123456','phone':'13400000000','subid':'','mttime':timenew} 语音验证码内容

data = urllib.urlencode(values)

req = urllib2.Request(url, data)

response = urllib2.urlopen(req)

the_page = response.read()

print the_page

文章来源:http://www.jinloushiji.cn
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息