So, I am trying to make a script that checks for bus redundancy. The source link for this is https://reservation.pc.gc.ca/ .
In the backup unit, you must select the following:
- Reservation: daily use (guided tours, Lake OHara bus).
- Park: Yoho Lake O'Hara
- Arrival Date: June 16
- Lot Size: 2
When these parameters are entered, you will go to the following page: https://reservation.pc.gc.ca/Yoho-LakeO'Hara? The calendar
I understand that if I send a POST request to this second link with the correct data, it should return the page I'm looking for
If I look in the dev network information settings, when I select the correct parameters, the form data:
__ EventTarget:
__ EVENTARGUMENT: __VIEWSTATE: - full string length -
__ VIEWSTATEGENERATOR: 8D0E13E6
ctl00 $ MainContentPlaceHolder $ rdbListReservationType: Events
ddlLocations: 213a1bc9-9218-4e98-9a7f-0f209008e437 **
ddlArrivalMonth: 2017-06-16
ddlArrivalDay: 19
ddlNights: 1
ddlDepartureMonth:
ddlDepartureDay:
ddlEquipment:
ddlEquipmentSub:
ddlPartySize: 2
ctl00 $ MainContentPlaceHolder $ chkExcludeAccessible: on
ctl00 $ MainContentPlaceHolder $ imageButtonCalendar.x: 64
ctl00 $ MainContentPlaceHolder $ imageButtonCalendar.y: 56
, , , :
import requests
payload = {
'__EVENTTARGET': '',
'__EVENTARGUMENT': '',
'__VIEWSTATE':-reallly long string-,
'__VIEWSTATEGENERATOR': '8D0E13E6',
'ctl00$MainContentPlaceHolder$rdbListReservationType': 'Events',
'ddlLocations': '213a1bc9-9218-4e98-9a7f-0f209008e437',
'ddlArrivalMonth': 2017-06-16,
'ddlArrivalDay': 19,
'ddlNights': 1,
'ddlDepartureMonth': '',
'ddlDepartureDay': '',
'ddlEquipment': '',
'ddlEquipmentSub': '',
'ddlPartySize': 2,
'ctl00$MainContentPlaceHolder$chkExcludeAccessible': 'on',
'ctl00$MainContentPlaceHolder$imageButtonCalendar.x': 64,
'ctl00$MainContentPlaceHolder$imageButtonCalendar.y': 56
}
r = requests.get(r"https://reservation.pc.gc.ca/Yoho-LakeO'Hara?Calendar", data=payload)
print r.text
r.text , , - GET . , , : . . , .