def get(self, *args, **kwargs):
try:<EOL><INDENT>req_func = self.session.get if self.session else requests.get<EOL>req = req_func(*args, **kwargs)<EOL>req.raise_for_status()<EOL>self.failed_last = False<EOL>return req<EOL><DEDENT>except requests.exceptions.RequestException as e:<EOL><INDENT>self.log_error(e)<EOL>for i in range(<NUM_LIT:1>, self.num_retries):<EOL><INDENT>sleep_time = self.retry_rate * i<EOL>self.log_function("<STR_LIT>" % sleep_time)<EOL>self._sleep(sleep_time)<EOL>try:<EOL><INDENT>req = requests.get(*args, **kwargs)<EOL>req.raise_for_status()<EOL>self.log_function("<STR_LIT>")<EOL>return req<EOL><DEDENT>except requests.exceptions.RequestException:<EOL><INDENT>self.log_function("<STR_LIT>")<EOL><DEDENT><DEDENT>if not self.failed_last:<EOL><INDENT>self.failed_last = True<EOL>raise ApiError(e)<EOL><DEDENT>else:<EOL><INDENT>raise FatalApiError(e)<EOL><DEDENT><DEDENT>
An interface for get requests that handles errors more gracefully to
prevent data loss