aliyun.connection module

class aliyun.connection.Connection(region_id, service, access_key_id=None, secret_access_key=None)[source]

Bases: object

get(params, paginated=False, encoding=None)[source]

Make a get request to the API.

Parameters:
  • params (dict) – The parameters to the request. Keys and values should be string types.
  • paginated (bool) – Should the results be paginated.
  • encoding (str) – Encoding of the parameters. By default reads stdin encoding, or failing that default encoding, or failing that utf8.
Returns:

Parsed result.

class aliyun.connection.Credentials(access_key_id, secret_access_key)

Bases: tuple

access_key_id

Alias for field number 0

secret_access_key

Alias for field number 1

exception aliyun.connection.Error[source]

Bases: exceptions.Exception

Base exception class for this module.

aliyun.connection.find_credentials()[source]

Tries to get the aliyun credentials from the following in priority:

  • environment variables
  • config file

The environment variables to use are:

  • ALI_ACCESS_KEY_ID
  • ALI_SECRET_ACCESS_KEY

If both of these are not found, it then looks for config files at:

$HOME/.aliyun.cfg
/etc/aliyun.cfg

The format of the file must be:

[default]
access_key_id=ACCESS_KEY
secret_access_key=SECRET_KEY