rafikamal

Checkride schedule check

Jan 26th, 2023
740
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.36 KB | None | 0 0
  1. import datetime
  2. import time
  3. import random
  4. import requests
  5. from bs4 import BeautifulSoup
  6.  
  7. URL = "https://app.squarespacescheduling.com/schedule.php?action=showCalendar&fulldate=1&owner=22570677&template=monthly"
  8.  
  9. DATA = {
  10.       'type':'21769248',
  11.       'calendar': '5344614',
  12.       'month': '2023-02-15',
  13.       'skip': 'true',
  14.       'options[qty]': '1',
  15.       'options[numDays]': '3',
  16.       'ignoreAppointment': '',
  17.       'appointmentType': '',
  18.       'calendarID': ''
  19. }
  20.  
  21. HEADERS = {
  22.       'cache-control': 'no-store, no-cache, must-revalidate',
  23.       'p3p': 'CP="CAO PSA OUR"',
  24.       'pragma': 'no-cache',
  25.       'set-cookie': 'PHPSESSID=6v52bg7aj2ahggc6l1o65nr8a7; expires=Sun, 26-Feb-2023 01:46:40 GMT; Max-Age=2591999; path=/; secure; HttpOnly; SameSite=None',
  26. }
  27.  
  28. old_response = ''
  29. while True:
  30.       response = requests.post(url = URL, data = DATA, headers=HEADERS)
  31.       current_time = datetime.datetime.now()
  32.       formatted_response = BeautifulSoup(response.text, 'html.parser').prettify()
  33.  
  34.       if random.random() > 0.99:
  35.             print(current_time)
  36.  
  37.       if old_response != formatted_response:
  38.             print(current_time)
  39.             print('====================\nOld:\n', old_response)
  40.             print('====================\nNew:\n', formatted_response)
  41.  
  42.       sleep_time = 10 + 10 * random.random()
  43.       time.sleep(sleep_time)
Advertisement
Add Comment
Please, Sign In to add comment