This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |