Skip to content

Commit

Permalink
fix qc issues
Browse files Browse the repository at this point in the history
  • Loading branch information
nanorepublica committed Jun 9, 2017
1 parent c37ecc6 commit 896bc10
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions duedil/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,23 @@
}
API_KEY = os.environ.get('DUEDIL_API_KEY')


class APILimitException(Exception):
pass


class APIMonthlyLimitException(APILimitException):
pass


def retry_throttling(exception):
if isinstance(exception, HTTPError):
if exception.response.status_code == 403:
if exception.response.reason == "Forbidden - Over rate limit":
if 'Developer Over Qps' in exception.response.text:
return True
# elif 'Developer Over Rate' in exception.response.text:
# raise APIMonthlyLimitException('Monthly Limit reached for Duedil calls')
if (isinstance(exception, HTTPError)
and exception.response.status_code == 403
and exception.response.reason == "Forbidden - Over rate limit"
and 'Developer Over Qps' in exception.response.text):
return True
# elif 'Developer Over Rate' in exception.response.text:
# raise APIMonthlyLimitException('Monthly Limit reached for Duedil calls')
return False


Expand Down

0 comments on commit 896bc10

Please sign in to comment.