From d44f13cc700c7a20339abd035b395d959421ed05 Mon Sep 17 00:00:00 2001 From: mhbahmani Date: Thu, 23 Nov 2023 01:00:58 +0330 Subject: [PATCH] Saving reserve request response for debugging --- src/dining.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dining.py b/src/dining.py index 97e0343..de34fd1 100644 --- a/src/dining.py +++ b/src/dining.py @@ -134,6 +134,8 @@ def reserve_food(self, place_id: int, foods: dict, choosed_food_indices: dict, r # file.write(bs(response.content, "html.parser").prettify()) # with open("food_data.txt", "w") as file: # file.writelines([f'{item}\n' for item in data]) + with open(f"out-{self.student_id}.html", "w") as file: + file.write(bs(response.content, "html.parser").prettify()) if "غذاهای ذیل تا حداکثر سقف ممکن توسط کاربران رزرو شده اند و امکان رزرو در آنها وجود ندارد" in text: raise(FoodsCapacityIsOver) if "تعداد مجاز رزرو روزانه شما بیش از حد مجاز است" in text: @@ -141,8 +143,6 @@ def reserve_food(self, place_id: int, foods: dict, choosed_food_indices: dict, r if "برنامه غذایی معادل پیدا نشد" in text or "لطفا مقدار مناسب وارد کنید" in text: raise(NoSuchFoodSchedule) if "اعتبار شما کم است" in text: - # with open(f"out-{self.student_id}.html", "w") as file: - # file.write(bs(response.content, "html.parser").prettify()) raise(NotEnoughCreditToReserve) self.remain_credit -= total_food_prices return self.remain_credit