How to use the safety.compat.import_module function in safety

To help you get started, we’ve selected a few safety examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ulule / django-safety / safety / utils.py View on Github external
def import_from_path(path):
    try:
        module_path, attr = path.rsplit('.', 1)
        module = import_module(module_path)
        obj = getattr(module, attr)
    except Exception as e:
        raise e
    return obj
github ulule / django-safety / safety / utils.py View on Github external
def get_session_store():
    mod = getattr(settings, 'SESSION_ENGINE', 'django.contrib.sessions.backends.db')
    engine = import_module(mod)
    store = engine.SessionStore()
    return store