Added dynamic ressource id (seat)
This commit is contained in:
parent
b388cc9245
commit
754752d0fd
2 changed files with 26 additions and 5 deletions
2
.github/workflows/schedule.yml
vendored
2
.github/workflows/schedule.yml
vendored
|
|
@ -3,7 +3,7 @@ name: Running Library Reservation Script
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '40,45,50,55 21 * * *'
|
- cron: '55 21 * * *'
|
||||||
- cron: '0 22 * * *'
|
- cron: '0 22 * * *'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
|
||||||
29
kit.py
29
kit.py
|
|
@ -107,7 +107,6 @@ def test_reservation():
|
||||||
|
|
||||||
cookies = login(username, password)
|
cookies = login(username, password)
|
||||||
|
|
||||||
|
|
||||||
TOKEN = cookies['anny_shop_jwt']
|
TOKEN = cookies['anny_shop_jwt']
|
||||||
|
|
||||||
ses = requests.Session()
|
ses = requests.Session()
|
||||||
|
|
@ -122,15 +121,37 @@ def test_reservation():
|
||||||
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0'
|
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
start_date = get_day() + "T13:00:00+02:00"
|
||||||
|
end_date = get_day() + "T18:00:00+02:00"
|
||||||
|
|
||||||
|
pre = ses.get(
|
||||||
|
'https://b.anny.eu/api/v1/resources/1-lehrbuchsammlung-eg-und-1-og/children',
|
||||||
|
params={
|
||||||
|
'page[number]': 1,
|
||||||
|
'page[size]': 250,
|
||||||
|
'filter[available_from]': start_date,
|
||||||
|
'filter[available_to]': end_date,
|
||||||
|
'filter[availability_exact_match]': 1,
|
||||||
|
'filter[exclude_hidden]': 0,
|
||||||
|
'filter[exclude_child_resources]': 0,
|
||||||
|
'filter[availability_service_id]': 449,
|
||||||
|
'filter[include_unavailable]': 0,
|
||||||
|
'filter[pre_order_ids]': '',
|
||||||
|
'sort': 'name'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
ressource_id = pre.json()['data'][0]['id']
|
||||||
|
|
||||||
r = ses.post(
|
r = ses.post(
|
||||||
'https://b.anny.eu/api/v1/order/bookings?include=customer,voucher,bookings.booking_add_ons.add_on.cover_image,bookings.sub_bookings.resource,bookings.sub_bookings.service,bookings.series_bookings,bookings.customer,bookings.service.custom_forms.custom_fields,bookings.cancellation_policy,bookings.resource.cover_image,bookings.resource.parent,bookings.resource.category,bookings.reminders,bookings.booking_series,sub_orders.bookings,sub_orders.organization.legal_documents&stateless=1',
|
'https://b.anny.eu/api/v1/order/bookings?include=customer,voucher,bookings.booking_add_ons.add_on.cover_image,bookings.sub_bookings.resource,bookings.sub_bookings.service,bookings.series_bookings,bookings.customer,bookings.service.custom_forms.custom_fields,bookings.cancellation_policy,bookings.resource.cover_image,bookings.resource.parent,bookings.resource.category,bookings.reminders,bookings.booking_series,sub_orders.bookings,sub_orders.organization.legal_documents&stateless=1',
|
||||||
json={
|
json={
|
||||||
"resource_id": [
|
"resource_id": [
|
||||||
"3305"
|
ressource_id
|
||||||
], "service_id": {
|
], "service_id": {
|
||||||
"449": 1
|
"449": 1
|
||||||
}, "start_date": get_day() + "T13:00:00+02:00",
|
}, "start_date": start_date,
|
||||||
"end_date": get_day() + "T18:00:00+02:00",
|
"end_date": end_date,
|
||||||
"description":"", "customer_note": "",
|
"description":"", "customer_note": "",
|
||||||
"add_ons_by_service": {
|
"add_ons_by_service": {
|
||||||
"449": [
|
"449": [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue