Skip to content

Commit

Permalink
fix: Adjust wait times and improve error handling in Udemy course pro…
Browse files Browse the repository at this point in the history
…cessing
  • Loading branch information
techtanic committed Nov 2, 2024
1 parent 7f65497 commit a392f21
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions base.py
Original file line number Diff line number Diff line change
Expand Up @@ -977,10 +977,15 @@ def process_coupon(self, course_id, coupon_code, amount):
self.enrolled_courses[course_id] = self.get_now_to_utc()
self.amount_saved_c += amount
self.save_course()
time.sleep(3.6)
time.sleep(3.7)
else:
self.print(checkout_response["detail"], color="light blue")
wait_time = int(re.search(r"\d+", checkout_response["detail"]).group(0))
try:
wait_time = int(re.search(r"\d+", checkout_response["detail"]).group(0))
except:
self.print("Unknown Error: Report this link to the developer", color="red")
self.print(checkout_response, color="red")
wait_time = 60
self.print(f">>> Pausing script for {wait_time} seconds\n", color="red")
time.sleep(wait_time + 1)
time.sleep(wait_time + 1.5)
self.process_coupon(course_id, coupon_code, amount)

0 comments on commit a392f21

Please sign in to comment.