utils Module

Functions

create_sas_token

Create a SAS token.

create_sas_token(key_name, shared_access_key, scope, expiry=datetime.timedelta(seconds=3600))

Parameters

Name Description
key_name
Required

The username/key name/policy name for the token.

shared_access_key
Required

The shared access key to generate the token from.

scope
Required

The token permissions scope.

expiry

The lifetime of the generated token. Default is 1 hour.

default value: 1:00:00

Returns

Type Description

data_factory

Wrap a Python type in the equivalent C AMQP type. If the Python type has already been wrapped in a ~uamqp.types.AMQPType object - then this will be used to select the appropriate C type.

  • bool => c_uamqp.BoolValue
  • int => c_uamqp.IntValue, LongValue, DoubleValue
  • str => c_uamqp.StringValue
  • bytes => c_uamqp.BinaryValue
  • list/set/tuple => c_uamqp.ListValue
  • dict => c_uamqp.DictValue (AMQP map)
  • float => c_uamqp.DoubleValue
  • uuid.UUID => c_uamqp.UUIDValue
data_factory(value, encoding='UTF-8')

Parameters

Name Description
value
Required

The value to wrap.

encoding
default value: UTF-8

Returns

Type Description

get_running_loop

get_running_loop()

parse_connection_string

Parse a connection string such as those provided by the Azure portal. Connection string should be formatted like: Key=Value;Key=Value;Key=Value. The connection string will be parsed into a dictionary.

parse_connection_string(connect_str)

Parameters

Name Description
connect_str
Required
str

The connection string.

Returns

Type Description