Skip to content

100sms/yibai-python-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 

Repository files navigation

yibai-python-sdk

The python sdk of https://www.100sms.cn/

  • 安装sdk
pip install yibai-sms-python-sdk
  • 代码调用示例
# encoding=utf8

import json
from yibai.api import *

server_url = 'https://xxxxxxx/api'
#此处为你的apikey,可登录网站查看你的apikey
apikey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
client = YibaiClient(server_url, apikey)


def test_sms_batch_submit():
    try:
        response = client.sms_batch_submit([
            {'mobile': '187xxxxxxxx', 'message': '【亿佰云通讯】您的验证码是:1234'},
            {'mobile': '186xxxxxxxx', 'message': '【亿佰云通讯】您的验证码是:5678'}
        ])
        print json.dumps(response)
    except YibaiApiError as e:
        print 'YibaiApiError. code: {0}, message: {1}'.format(e.code, e.message.encode('utf8'))
    except Exception as e:
        print 'Unexpected error. ' + e.message


def test_sms_pull_status_report():
    try:
        response = client.sms_pull_status_report()
        print json.dumps(response)
    except YibaiApiError as e:
        print 'YibaiApiError. code: {0}, message: {1}'.format(e.code, e.message.encode('utf8'))
    except Exception as e:
        print 'Unexpected error.' + e.message


def test_sms_pull_reply_message():
    try:
        response = client.sms_pull_reply_message()
        print json.dumps(response)
    except YibaiApiError as e:
        print 'YibaiApiError. code: {0}, message: {1}'.format(e.code, e.message.encode('utf8'))
    except Exception as e:
        print 'Unexpected error.' + e.message


test_sms_pull_reply_message()

注意事项

Releases

No releases published

Packages

No packages published

Languages