probator.wrappers.
BaseWrapper
(*args)¶Bases: abc.ABC
Base wrapper class, setting up a logger, as well as default __get__ method
log
¶An instance of logging.Logger
Type: | logging.Logger |
---|
func
¶A reference to the wrapped function
Type: | function |
---|
probator.wrappers.
retry
(*args)¶Bases: probator.wrappers.BaseWrapper
Decorator class to handle retrying calls if an exception occurs, with an exponential backoff. If the function fails to execute without raising an exception 3 times, the exception is re-raised
probator.wrappers.
rollback
(*args)¶Bases: probator.wrappers.BaseWrapper
Decorator class to handle rolling back database transactions after a function is done running. If the wrapped function is a member of a BaseView class it will also return any exceptions as a proper API resopnse, else re-raise the exception thrown.
Due to a caching mechanic within SQLAlchemy, we perform a rollback on every request regardless or we might end up getting stale data from a cached connection / existing transaction instead of live data.
probator.wrappers.
check_auth
(*args)¶Bases: probator.wrappers.BaseWrapper
Decorator class to handle authentication checks for API endpoints. If the user is not authenticated it will return a 401 UNAUTHORIZED response to the user