confidant.utils package

Submodules

confidant.utils.dynamodb module

confidant.utils.dynamodb.create_dynamodb_tables()
confidant.utils.dynamodb.decode_last_evaluated_key(last_evaluated_key)
confidant.utils.dynamodb.encode_last_evaluated_key(last_evaluated_key)

confidant.utils.maintenance module

confidant.utils.maintenance.check_maintenance_mode(f)
confidant.utils.maintenance.in_maintenance_mode()

confidant.utils.misc module

confidant.utils.misc.dict_deep_update(a, b)

Deep merge in place of two dicts. For all keys in b, override matching keys in a. If both a and b have a dict at a given key, recursively update a.

Parameters:
  • a (dict) – Left hand side dict to update in place

  • b (dict) – Right hand side with values to pull in

confidant.utils.misc.get_boolean(val, default=False)

Given a value, check if if corresponds to True or False. Python’s bool() does not behave as expected for strings so we have a helper function here

confidant.utils.misc.load_module(module_path)

Load’s a python module.

ex: module_path = “confidant.authnz.rbac:no_acl”

Will load the module confidant.authnz.rbac and return the function no_acl

confidant.utils.misc.prevent_xss_decorator(func)
Prevents XSS attacks:
  1. Set content type to be application/json

  2. Set Content Security Policy (already specified at app level)

  3. Enable XSS Protection

  4. Prevent MIME Type Sniffing

  5. Limit Referrer Information

confidant.utils.misc.utcnow()

Returns the current time with tzinfo=’UTC’. datetime.utcnow() currently does not populate tzinfo

Module contents