Skip to content

Commit

Permalink
test rst
Browse files Browse the repository at this point in the history
  • Loading branch information
houluy committed Aug 3, 2017
1 parent 7e37982 commit f4ad9cf
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions docs/source/index.rst
Expand Up @@ -19,18 +19,19 @@ AliyunSMS Object has the following attributes and methods::

*Class*

* `config_file`: Configure file name
* `access_key_id`: accessKeyId of Aliyun *sub-account* (*subaccount* is recommended for security)
* `access_key_secret`: accessKeySecret of the id (vital)
* `region_id`: Region name of your SMS service
* `host`: API host, default is enough
* `config_file`: Configure file name.
* `access_key_id`: *accessKeyId* of Aliyun *sub-account* (*subaccount* is recommended for security).
* `access_key_secret`: *accessKeySecret* of the id (vital).
* `region_id`: Region name of your SMS service.
* `host`: API host, default is enough.

% A new instance of AliyunSMS class.

AliyunSMS Public Attributes
===========================

::

AliyunSMS.sms_params

This is the `dict` of parameters for SMS request. It can be get and set directly (A `dict` is mandatory)
Expand All @@ -39,19 +40,23 @@ AliyunSMS Methods
=================

::

AliyunSMS.generate_signature(params=None, method='GET', url='/')

This function can generate signature based on the `params`, `method` and `url`. Of course `access_key_secret` is necessary!

* `params`: A `dict` parameters for the request, `OrderedDict` is better since the sequence is of importance.
* `method`: HTTP method for the request, default `GET`.
* `url`: Url endpoint of the request, default is `/` if using `send_sms()`.

% The signature string

::

AliyunSMS.send_sms(phone_numbers, sign_name, template_code, template_params=None, raw=True, **kwargs)
This function is used to send SMS via Aliyun API.

* `phone_numbers`: The list of phone numbers, can be a string if only one number
* `sign_name`: Sign name configured in Aliyun console
* `template_code`: The template code defined in Aliyun console
Expand All @@ -61,6 +66,7 @@ This function is used to send SMS via Aliyun API.
% Status: success or failure

::

AliyunSMS.query_details(phone_number, serial_number='', send_date='', page_size='10', current_page='1', raw=True, **kwargs)
This function is used to query sending histories specified by `phone_number` and `send_date`.
Expand All @@ -78,19 +84,23 @@ Useful Functions
================

::

utils.hmac64(object_str, secret, alg='sha1')

Compute the *HMAC-\{alg\}* of the `object\_str` with `secret` and get the return after `base64` encoding

* `object_str`: Original string that needs to be encrypted.
* `secret`: secret string.
* `alg`: HMAC algorithm, default `sha1`.

% The encrypted string

::

utils.parse_config(config_file, part='_all')

Parse config file, a *YAML* file is mandatory

* `config_file`: Configure file name.
* `part`: Return part of the configures, default is `_all`.

Expand Down

0 comments on commit f4ad9cf

Please sign in to comment.