Skip to content

Commit

Permalink
Merge pull request #118 from BrockA/patch-2
Browse files Browse the repository at this point in the history
Better exception handling around quota_remaining
  • Loading branch information
normalhuman committed Dec 20, 2015
2 parents 502a89f + 4cd6eec commit 691ef18
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bodyfetcher.py
Expand Up @@ -79,7 +79,11 @@ def make_api_call_for_site(self, site):
if "quota_remaining" in response:
if response["quota_remaining"] - GlobalVars.apiquota >= 1000 and GlobalVars.apiquota >= 0:
GlobalVars.charcoal_hq.send_message("API quota rolled over with {} requests remaining.".format(GlobalVars.apiquota))
elif response["quota_remaining"] == 0:
GlobalVars.charcoal_hq.send_message("API reports no quota left! May be a glitch.")
GlobalVars.apiquota = response["quota_remaining"]
else:
GlobalVars.charcoal_hq.send_message("The quota_remaining property was not in the API response.")

if site == "stackoverflow.com":
if len(response["items"]) > 0 and "last_activity_date" in response["items"][0]:
Expand Down

0 comments on commit 691ef18

Please sign in to comment.