sms api在一个请求中向澳大利亚移动电话发送sms消息。这个api允许您发送和接收消息。您还可以查询先前发送的SMS消息的状态。##身份验证此api使用oauth v2承载令牌进行身份验证。这种身份验证需要发送的参数如下:+`consumer-key`-您的consumer-key+`consumer-secret`-您的consumer-secret
testinweweewewe的Python项目详细描述
#入门
sms api在一个请求中向澳大利亚移动电话发送sms消息。这个api允许您发送和接收消息。您还可以查询以前发送的短信的状态。
consumer key
+`consumer嫒secret`-您的consumer secret
\how to build
必须在系统上安装python``2>;=2.7.9``或python``3>;=3.4```才能安装和运行此sdk。此sdk包依赖于其他python包,如nose、jsonpickle等。
这些依赖项在sdk附带的``requirements.txt``文件中定义。
要解决这些依赖项,可以使用pip依赖项管理器。按照[https://pip.pypa.io/en/stable/installing/](https://pip.pypa.io/en/stable/installing/)中的步骤安装它。
python和pip可执行文件应在路径中定义。打开命令提示符并键入``pip--version``.
如果安装成功并正确定义了路径,则应显示安装的pip依赖关系管理器的版本。
*使用命令行,导航到包含为sdk生成的文件(包括``requirements.txt```)的目录。
*运行命令``pip install-r requirements.txt```。这应该安装所有必需的依赖项。
![构建sdk-步骤1](https://apidocs.io/illustration/python?step=installdependencies&workspacefolder=aazar%20khan%20telstra%20ms%20api python)
在ide中打开项目
打开python ide,比如pycharm。如果您喜欢使用不同的编辑器或IDE,这里提供的基本工作流也适用。
![在PyCharm中打开项目-步骤1](https://apidocs.io/illustration/python?step=pycharm)
[在PyCharm中打开项目-第2步](https://apidocs.io/illustration/python?step=openproject0&workspacefolder=aazar%20khan%20telstra%20sms%20api python)
项目文件将显示在侧栏中,如下所示:
![在PyCharm中打开项目-第3步](https://apidocs.io/illustration/python?step=openproject1&workspacefolder=aazar%20khan%20telstra%20sms%20api python&;projectname=testinweewewewewewewe)
2。添加一个新的测试项目
右键单击解决方案名称创建一个新目录,如下所示:
![在PyCharm中添加新项目-步骤1](https://apidocs.io/illustration/python?step=createdirectory&workspacefolder=aazar%20khan%20telstra%20sms%20api python&;projectname=testinwewewewe)
将目录命名为"test"
![在PyCharm中添加新项目-步骤2](https://apidocs.io/illustration/python?step=nameditory)
将一个名为"testsdk"的python文件添加到此项目中
![在PyCharm中添加新项目-步骤3](https://apidocs.io/illustration/python?step=createfile&workspacefolder=aazar%20khan%20telstra%20sms%20api python&;projectname=testinweewewewewewe)
[在PyCharm中添加新项目-步骤4](https://apidocs.io/illustration/python?step=namefile)
在您的python文件中,您需要使用以下代码行从testinweewewewewewe.testinweewewewewewewewe客户端导入生成的python库
``python
![在PyCharm中添加新项目-步骤4](https://apidocs.io/illustration/python?step=projectfiles&workspacefolder=aazar%20khan%20telstra%20sms%20api python&;libraryname=testinweewewe.testinewewewewewewewewe_client&projectname=testinewewewewewewewewewewewewewe&classname=testineweweweweweweweclient)
在此之后,您可以编写代码来实例化api客户端对象、获取控制器对象并进行api调用。示例代码在后续章节中给出。
3.运行测试项目
若要在测试项目中运行该文件,请右键单击测试项目中的python文件,然后单击"运行"`
![运行测试项目-步骤1](https://apidocs.io/illustation/python?step=runproject&workspacefolder=aazar%20khan%20telstra%20ms%20api python&;libraryname=testinweewewewewewewe.testinweewewewewewewewewe_client&projectname=testinweewewewewewewewe&;classname=testinweweeweclient)
\unittest用作测试框架,nose用作测试
运行器。您可以按如下方式运行测试:
1。从terminal/cmd导航到sdk的根目录。
2。调用``pip install-r test requirements.txt``
3。调用``nosetests``
您需要以下信息。
凭据
o_auth_access_token='o_auth_access_token'oauth 2.0访问令牌
```
控制器列表[类:](https://apidocs.io/img/class.png.api controller)apicontroller
a name="create_send_sms">;<;/a>;![方法:](https://apidocs.io/img/method.png".apicontroller.create_send_sms")create_send_sms
>;send sms方法向单个澳大利亚移动电话号码发送sms消息。响应中返回的唯一标识符(MessageID),可用于查询消息的传递状态。
`` python
def create_send_sms(self,
content_type,
body)
```````
参数参数标签描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述;
contenttype contenttype contenttype contenttype ```````````````````````````````````````````````````````````````````````````````````````````````````:添加参数说明|
``
a name="get_authentication">;<;/a>;![方法:](https://apidocs.io/img/method.png".apicontroller.get戋authentication")get戋authentication
>;若要获取OAuth 2.0身份验证令牌,请传递您在注册SMS API密钥时收到的使用者密钥和使用者密钥。授权类型应保留为?客户端凭据?范围是什么?短讯服务?。令牌将在一小时后过期。
`` python
def get_authentication(self,
client_id,
client_secret,
grant_type=none,
范围=无)
```
`````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````示例用法="客户端密码"
客户端密码="客户端密码"
授权类型="授权类型"
作用域="作用域"
结果=客户端控制器。获取身份验证(客户端密码、客户端密码、授权类型、作用域)
````
[方法:](https://apidocs.io/img/method.png".apicontroller.get_message_response")get_message_response
>;您的短信收件人可以发送回复,您可以使用get message response方法检索该回复。通过send sms方法的响应返回的唯一标识符(MessageID),您将收到响应和时间戳。
``python
def get_message_response(self,
message-id
````
示例用法
`` python
message_id='message_id'
result=client_controller.get_message_response(message_id)
````
[方法:](https://apidocs.io/img/method.png".apicontroller.get_message_status")获取信息状态
>;使用send sms方法的响应返回的唯一标识符(MessageID)获取状态。
`` python
def get_message_status(self)
````
=客户端控制器。获取"消息"状态(
```
[返回控制器列表]("控制器列表")
sms api在一个请求中向澳大利亚移动电话发送sms消息。这个api允许您发送和接收消息。您还可以查询以前发送的短信的状态。
consumer key
+`consumer嫒secret`-您的consumer secret
\how to build
必须在系统上安装python``2>;=2.7.9``或python``3>;=3.4```才能安装和运行此sdk。此sdk包依赖于其他python包,如nose、jsonpickle等。
这些依赖项在sdk附带的``requirements.txt``文件中定义。
要解决这些依赖项,可以使用pip依赖项管理器。按照[https://pip.pypa.io/en/stable/installing/](https://pip.pypa.io/en/stable/installing/)中的步骤安装它。
python和pip可执行文件应在路径中定义。打开命令提示符并键入``pip--version``.
如果安装成功并正确定义了路径,则应显示安装的pip依赖关系管理器的版本。
*使用命令行,导航到包含为sdk生成的文件(包括``requirements.txt```)的目录。
*运行命令``pip install-r requirements.txt```。这应该安装所有必需的依赖项。
![构建sdk-步骤1](https://apidocs.io/illustration/python?step=installdependencies&workspacefolder=aazar%20khan%20telstra%20ms%20api python)
在ide中打开项目
打开python ide,比如pycharm。如果您喜欢使用不同的编辑器或IDE,这里提供的基本工作流也适用。
![在PyCharm中打开项目-步骤1](https://apidocs.io/illustration/python?step=pycharm)
[在PyCharm中打开项目-第2步](https://apidocs.io/illustration/python?step=openproject0&workspacefolder=aazar%20khan%20telstra%20sms%20api python)
项目文件将显示在侧栏中,如下所示:
![在PyCharm中打开项目-第3步](https://apidocs.io/illustration/python?step=openproject1&workspacefolder=aazar%20khan%20telstra%20sms%20api python&;projectname=testinweewewewewewewe)
2。添加一个新的测试项目
右键单击解决方案名称创建一个新目录,如下所示:
![在PyCharm中添加新项目-步骤1](https://apidocs.io/illustration/python?step=createdirectory&workspacefolder=aazar%20khan%20telstra%20sms%20api python&;projectname=testinwewewewe)
将目录命名为"test"
![在PyCharm中添加新项目-步骤2](https://apidocs.io/illustration/python?step=nameditory)
将一个名为"testsdk"的python文件添加到此项目中
![在PyCharm中添加新项目-步骤3](https://apidocs.io/illustration/python?step=createfile&workspacefolder=aazar%20khan%20telstra%20sms%20api python&;projectname=testinweewewewewewe)
[在PyCharm中添加新项目-步骤4](https://apidocs.io/illustration/python?step=namefile)
在您的python文件中,您需要使用以下代码行从testinweewewewewewe.testinweewewewewewewewe客户端导入生成的python库
``python
![在PyCharm中添加新项目-步骤4](https://apidocs.io/illustration/python?step=projectfiles&workspacefolder=aazar%20khan%20telstra%20sms%20api python&;libraryname=testinweewewe.testinewewewewewewewewe_client&projectname=testinewewewewewewewewewewewewewe&classname=testineweweweweweweweclient)
在此之后,您可以编写代码来实例化api客户端对象、获取控制器对象并进行api调用。示例代码在后续章节中给出。
3.运行测试项目
若要在测试项目中运行该文件,请右键单击测试项目中的python文件,然后单击"运行"`
![运行测试项目-步骤1](https://apidocs.io/illustation/python?step=runproject&workspacefolder=aazar%20khan%20telstra%20ms%20api python&;libraryname=testinweewewewewewewe.testinweewewewewewewewewe_client&projectname=testinweewewewewewewewe&;classname=testinweweeweclient)
\unittest用作测试框架,nose用作测试
运行器。您可以按如下方式运行测试:
1。从terminal/cmd导航到sdk的根目录。
2。调用``pip install-r test requirements.txt``
3。调用``nosetests``
您需要以下信息。
凭据
o_auth_access_token='o_auth_access_token'oauth 2.0访问令牌
控制器列表[类:](https://apidocs.io/img/class.png.api controller)apicontroller
a name="create_send_sms">;<;/a>;![方法:](https://apidocs.io/img/method.png".apicontroller.create_send_sms")create_send_sms
>;send sms方法向单个澳大利亚移动电话号码发送sms消息。响应中返回的唯一标识符(MessageID),可用于查询消息的传递状态。
`` python
def create_send_sms(self,
content_type,
body)
```````
参数参数标签描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述描述;
contenttype contenttype contenttype contenttype ```````````````````````````````````````````````````````````````````````````````````````````````````:添加参数说明|
``
a name="get_authentication">;<;/a>;![方法:](https://apidocs.io/img/method.png".apicontroller.get戋authentication")get戋authentication
>;若要获取OAuth 2.0身份验证令牌,请传递您在注册SMS API密钥时收到的使用者密钥和使用者密钥。授权类型应保留为?客户端凭据?范围是什么?短讯服务?。令牌将在一小时后过期。
`` python
def get_authentication(self,
client_id,
client_secret,
grant_type=none,
范围=无)
```
`````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````示例用法="客户端密码"
客户端密码="客户端密码"
授权类型="授权类型"
作用域="作用域"
结果=客户端控制器。获取身份验证(客户端密码、客户端密码、授权类型、作用域)
````
[方法:](https://apidocs.io/img/method.png".apicontroller.get_message_response")get_message_response
>;您的短信收件人可以发送回复,您可以使用get message response方法检索该回复。通过send sms方法的响应返回的唯一标识符(MessageID),您将收到响应和时间戳。
``python
def get_message_response(self,
message-id
````
示例用法
`` python
message_id='message_id'
result=client_controller.get_message_response(message_id)
````
[方法:](https://apidocs.io/img/method.png".apicontroller.get_message_status")获取信息状态
>;使用send sms方法的响应返回的唯一标识符(MessageID)获取状态。
`` python
def get_message_status(self)
````
=客户端控制器。获取"消息"状态(
```
[返回控制器列表]("控制器列表")