summaryrefslogtreecommitdiff
path: root/jimbrella/jform.py
diff options
context:
space:
mode:
authorFrederick Yin <fkfd@fkfd.me>2022-02-01 18:15:22 +0800
committerFrederick Yin <fkfd@fkfd.me>2022-02-01 18:15:22 +0800
commit3c781cba418f09d9d7249c5e7bef82ffcc1b5cfa (patch)
tree0552530fd8fd2d28e45ae2a926e7f11cebff24ef /jimbrella/jform.py
parent8953c6b8189010c37dad8380acb06ba36e08537f (diff)
JForm key number defaults to None when answer is not a number
Diffstat (limited to 'jimbrella/jform.py')
-rw-r--r--jimbrella/jform.py7
1 files changed, 4 insertions, 3 deletions
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"]),
}
)