Skip to content

Commit

Permalink
add simple laundry site check
Browse files Browse the repository at this point in the history
  • Loading branch information
ezwang committed Mar 18, 2019
1 parent 1cd0a7d commit 9e3b8f9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions penn/laundry.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,25 @@ def hall_status(self, hall_id):
'location': location
}

def check_is_working(self):
""" Returns True if the wash alert web interface seems to be
working properly, or False otherwise.
>>> l.check_is_working()
"""
try:
r = requests.post(USAGE_BASE_URL, timeout=60, data={
"locationid": "5faec7e9-a4aa-47c2-a514-950c03fac460",
"email": "[email protected]",
"washers": 0,
"dryers": 0,
"locationalert": "OK"
})
r.raise_for_status()
return "The transaction log for database 'QuantumCoin' is full due to 'LOG_BACKUP'." not in r.text
except requests.exceptions.HTTPError:
return False

def machine_usage(self, hall_no):
"""Returns the average usage of laundry machines every hour
for a given hall.
Expand Down

0 comments on commit 9e3b8f9

Please sign in to comment.