Skip to content

Instantly share code, notes, and snippets.

View mekarpeles's full-sized avatar
📚
Universal Access to All Knowledge

Mek mekarpeles

📚
Universal Access to All Knowledge
View GitHub Profile
@mekarpeles
mekarpeles / decorate.py
Last active December 11, 2015 17:19 — forked from anonymous/decorate.py
Added debug kwarg
def exponential_backoff(exception, err=None, tries=5, debug=False):
"""Exponentially backoff on a certain Exception exception.
params:
tries - num of expn backed off attempts before quitting
err - custom error msg to display in addition to 'e'
debug - default False, boolean deciding whether to raise
error msg e along with Exception instance
note:
* debug flag used to avoid raising security sensitive exception err msgs