一个围绕bluevia api的python包装器。
pyBlueVia的Python项目详细描述
pybluevia是一个apache2许可的库,用python编写,用于 更容易使用BlueViaapi。
pybluevia实现了一个封装bluevia api的Api类, 提供方法:
- 为需要access token的api管理oauth 2.0授权过程。
- 发送短信和彩信。
- 询问已发送短信/彩信的发送状态。
- 检索发送到应用程序的短信/彩信。
- 解析来自BlueVia的通知(传送状态和收到的短信/彩信)。
安装
安装pybluevia:
$ pip install pyBlueVia
示例
以下是一些关于如何使用pybluevia发送短信和查询的示例 其交货状态:
# Create the API wrapperbluevia_client=bluevia.Api(CLIENT_ID,CLIENT_SECRET,ACCESS_TOKEN)# Send an SMSsms_id=bluevia_client.send_sms(to='34600000000',message='Hello world!')# Ask for the delivery status of the sent SMSdelivery_status=bluevia_client.get_sms_delivery_status(sms_id)print'Delivery status for the SMS sent to {0}: {1}'.format(delivery_status['address'],delivery_status['status'])
您可以看到更多的用法示例here。
查看https://pybluevia.readthedocs.org/上的整个文档。