def retry(method):
def inner(self, *args, **kwargs):<EOL><INDENT>attempt_number = <NUM_LIT:1><EOL>while attempt_number < self.retries:<EOL><INDENT>try:<EOL><INDENT>return method(self, *args, **kwargs)<EOL><DEDENT>except HasOffersException as exc:<EOL><INDENT>if '<STR_LIT>' not in str(exc):<EOL><INDENT>raise exc<EOL><DEDENT>self.logger.debug('<STR_LIT>', exc)<EOL>time.sleep(self.retry_timeout)<EOL><DEDENT>except requests.exceptions.ConnectionError:<EOL><INDENT>self.logger.debug('<STR_LIT>')<EOL>self._session = requests.Session()<EOL><DEDENT>attempt_number += <NUM_LIT:1><EOL><DEDENT>raise MaxRetriesExceeded<EOL><DEDENT>return inner<EOL>
Allows to retry method execution few times.