amazon_kinesis_utils package

Submodules

baikonur_logging module

Utilities specific to Baikonur Kinesis/Lambda logging modules.

kinesis module

Utilities to work with Kinesis Aggregated records, JSON events coming from CloudWatch Logs with subscription filters, gzipped JSON data and more.

misc module

Various utilities useful when working with Kinesis Data Streams.

amazon_kinesis_utils.misc.dict_get_default(dictionary: dict, key: str, default: any, verbose: bool = False) Any

Get key from dictionary if key is in dictionary, default value otherwise

Parameters:
  • dictionary – dictionary to retrieve key from

  • key – key name in dictionary

  • default – value to return if key is not in dictionary

  • verbose – output detailed warning message when returning default value

Returns:

value for key if key is in dictionary, default value otherwise

amazon_kinesis_utils.misc.split_list(lst: list, n: int) List[list]

Split a list of object in chunks of size n

Parameters:
  • lst – List to split in chunks

  • n – Size of chunk (last chunk may be less than n)

s3 module

Utilities to save string data to S3 easily.

amazon_kinesis_utils.s3.put_str_data(client, bucket: str, key: str, data: str, gzip_compress: bool = False)

Put str data to S3 bucket with optional gzip compression

Parameters:
  • client – S3 API client (e.g. boto3.client(‘s3’) )

  • bucket – S3 bucket name

  • key – S3 object key

  • data – Data to save

  • gzip_compress – Boolean switch to control gzip compression (default = False)

Module contents