Skip to content

Commit

Permalink
Saving reserve request response for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
mhbahmani committed Nov 22, 2023
1 parent b0fe1ea commit d44f13c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/dining.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,15 @@ 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:
raise(AlreadyReserved)
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
Expand Down

0 comments on commit d44f13c

Please sign in to comment.