From 65a693515ff420a92dbfb38632726425c650170f Mon Sep 17 00:00:00 2001 From: Moe Date: Sun, 12 Apr 2020 16:18:41 +0700 Subject: [PATCH] Fix error when input Invalid ID --- Quintal/quintal.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Quintal/quintal.py b/Quintal/quintal.py index 3e1ba5f..b6f5a3c 100644 --- a/Quintal/quintal.py +++ b/Quintal/quintal.py @@ -17,10 +17,9 @@ class QuintalGrabber: self.host = "https://quintal.id" self.id = str(id) self.endpoint = "/id/api/initial_data/{}/?format=json".format(self.id) - try: - self.req = requests.get(self.host + self.endpoint) - self.data = json.loads(self.req.text) - except: + self.req = requests.get(self.host + self.endpoint) + self.data = json.loads(self.req.text) + if "status" in self.data: print ("Invalid ID") sys.exit()