Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import datetime
- import time
- import random
- import requests
- from bs4 import BeautifulSoup
- URL = "https://app.squarespacescheduling.com/schedule.php?action=showCalendar&fulldate=1&owner=22570677&template=monthly"
- DATA = {
- 'type':'21769248',
- 'calendar': '5344614',
- 'month': '2023-02-15',
- 'skip': 'true',
- 'options[qty]': '1',
- 'options[numDays]': '3',
- 'ignoreAppointment': '',
- 'appointmentType': '',
- 'calendarID': ''
- }
- HEADERS = {
- 'cache-control': 'no-store, no-cache, must-revalidate',
- 'p3p': 'CP="CAO PSA OUR"',
- 'pragma': 'no-cache',
- 'set-cookie': 'PHPSESSID=6v52bg7aj2ahggc6l1o65nr8a7; expires=Sun, 26-Feb-2023 01:46:40 GMT; Max-Age=2591999; path=/; secure; HttpOnly; SameSite=None',
- }
- old_response = ''
- while True:
- response = requests.post(url = URL, data = DATA, headers=HEADERS)
- current_time = datetime.datetime.now()
- formatted_response = BeautifulSoup(response.text, 'html.parser').prettify()
- if random.random() > 0.99:
- print(current_time)
- if old_response != formatted_response:
- print(current_time)
- print('====================\nOld:\n', old_response)
- print('====================\nNew:\n', formatted_response)
- sleep_time = 10 + 10 * random.random()
- time.sleep(sleep_time)
Advertisement
Add Comment
Please, Sign In to add comment