From 3c781cba418f09d9d7249c5e7bef82ffcc1b5cfa Mon Sep 17 00:00:00 2001 From: Frederick Yin Date: Tue, 1 Feb 2022 18:15:22 +0800 Subject: JForm key number defaults to None when answer is not a number --- jimbrella/jform.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'jimbrella/jform.py') diff --git a/jimbrella/jform.py b/jimbrella/jform.py index dc9d769..c6503c1 100644 --- a/jimbrella/jform.py +++ b/jimbrella/jform.py @@ -77,9 +77,9 @@ class JForm: Keys of a dict in the list: - name: (string) Tenant's name. - - id: (uint) Tenant's student/faculty ID. + - id: (string) Tenant's student/faculty ID. - phone: (string) Tenant's phone number. - - key: (uint) Number of key to umbrella. + - key: (uint) Number of key to umbrella. Is None if it is not a number. - date: (datetime.datetime) When the jForm answer sheet was submitted. """ bookmark = self._read_bookmark() @@ -92,6 +92,7 @@ class JForm: resp = self._get(page=page) except: break # quietly abort + if resp.status_code != 200: break @@ -121,7 +122,7 @@ class JForm: "name": ans[0]["answer"], "id": ans[1]["answer"], "phone": ans[2]["answer"], - "key": int(ans[3]["answer"]), + "key": int(ans[3]["answer"]) if ans[3]["answer"].isdecimal() else None, "date": isoparse(sheet["submitted_at"]), } ) -- cgit v1.2.3