Skip to content

Commit

Permalink
Fix for when no active maintenance
Browse files Browse the repository at this point in the history
  • Loading branch information
nbowes24 committed Feb 24, 2020
1 parent e132daf commit 2779803
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion exporter/status_cake_client/maintenance.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#!/usr/bin/env python3

import logging
import requests
import sys

from .base import get

logger = logging.getLogger(__name__)
Expand All @@ -12,6 +15,14 @@ def get_maintenance(apikey, username, state="ACT"):
"state": state
}

response = get(apikey, username, endpoint, params)
try:
response = get(apikey, username, endpoint, params)
except requests.exceptions.HTTPError as e:
if e.response.status_code == 404:
logger.info("Currently no active maintenance")
response = e.response
else:
logger.error(e)
sys.exit(1)

return response

0 comments on commit 2779803

Please sign in to comment.