#!/usr/local/bin/python
#-
-Coding:utf-8--
author:jackytime:14-2-22 pm 11:48desc: Python code invocation example for SMS HTTP interface
Import Httplib
Import Urllib
Import JSON
#服务地址
Host = "Intapi.253.com"
#端口号
Port = 80
#版本号
Version = "v1.1"
#查账户信息的URI
Balance_get_uri = "/balance/json"
#智能匹配模版短信接口的URI
Sms_send_uri = "/send/json"
#创蓝账号
account = ""
#创蓝密码
Password = ""
Def get_user_balance ():
"""
Take account 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
def send_sms (text, phone):
"""
can send text messages with the interface
"""
If name = = 'main':
#手机号码, Format (area code + mobile number), for example: 8615800000000, where 86 is China's area code
Phone = "8615800000000"
Text = "253 Cloud Communication" Your verification code is 1234 "
#查账户余额print(get_user_balance())
"Python" SMS Verification Code platform query account balance Demo---Gen Blue 253 cloud communication platform case