|
@@ -4,7 +4,6 @@ import logging
|
|
|
import os
|
|
import os
|
|
|
import random
|
|
import random
|
|
|
import time
|
|
import time
|
|
|
-import warnings
|
|
|
|
|
from dataclasses import dataclass
|
|
from dataclasses import dataclass
|
|
|
from room_cal._utils import local_today as _local_today
|
|
from room_cal._utils import local_today as _local_today
|
|
|
from urllib.parse import parse_qs, urlparse
|
|
from urllib.parse import parse_qs, urlparse
|
|
@@ -502,7 +501,6 @@ class _BookingClient:
|
|
|
async def _fetch_month_calendar(self, month: int, year: int) -> dict[str, DayInfo]:
|
|
async def _fetch_month_calendar(self, month: int, year: int) -> dict[str, DayInfo]:
|
|
|
start, end = month_bounds(month, year)
|
|
start, end = month_bounds(month, year)
|
|
|
if _is_past(end):
|
|
if _is_past(end):
|
|
|
- warnings.warn(f'Booking.com: skipping calendar fetch for past month {year}-{month:02d}', stacklevel=3)
|
|
|
|
|
return {}
|
|
return {}
|
|
|
body = {
|
|
body = {
|
|
|
'dates': {'range': True, 'dates': [start, end]},
|
|
'dates': {'range': True, 'dates': [start, end]},
|
|
@@ -684,7 +682,6 @@ class _BookingClient:
|
|
|
if is_stale('booking'):
|
|
if is_stale('booking'):
|
|
|
raise BookingAuthError(f'Booking.com credentials are stale — run: {_AUTH_HINT}')
|
|
raise BookingAuthError(f'Booking.com credentials are stale — run: {_AUTH_HINT}')
|
|
|
if _is_past(d):
|
|
if _is_past(d):
|
|
|
- warnings.warn(f'Booking.com: skipping set_price for past date {d}', stacklevel=2)
|
|
|
|
|
return
|
|
return
|
|
|
if (cached := self._cache.get(d)) and cached.price == price:
|
|
if (cached := self._cache.get(d)) and cached.price == price:
|
|
|
return
|
|
return
|
|
@@ -721,7 +718,6 @@ class _BookingClient:
|
|
|
if is_stale('booking'):
|
|
if is_stale('booking'):
|
|
|
raise BookingAuthError(f'Booking.com credentials are stale — run: {_AUTH_HINT}')
|
|
raise BookingAuthError(f'Booking.com credentials are stale — run: {_AUTH_HINT}')
|
|
|
if _is_past(d):
|
|
if _is_past(d):
|
|
|
- warnings.warn(f'Booking.com: skipping set_availability for past date {d}', stacklevel=2)
|
|
|
|
|
return
|
|
return
|
|
|
expected_rts = 1 if available else 0
|
|
expected_rts = 1 if available else 0
|
|
|
if (cached := self._cache.get(d)) and cached.available == available and cached.rooms_to_sell == expected_rts:
|
|
if (cached := self._cache.get(d)) and cached.available == available and cached.rooms_to_sell == expected_rts:
|
|
@@ -753,7 +749,6 @@ class _BookingClient:
|
|
|
if is_stale('booking'):
|
|
if is_stale('booking'):
|
|
|
raise BookingAuthError(f'Booking.com credentials are stale — run: {_AUTH_HINT}')
|
|
raise BookingAuthError(f'Booking.com credentials are stale — run: {_AUTH_HINT}')
|
|
|
if _is_past(d):
|
|
if _is_past(d):
|
|
|
- warnings.warn(f'Booking.com: skipping set_rooms_to_sell for past date {d}', stacklevel=2)
|
|
|
|
|
return
|
|
return
|
|
|
entry: dict = {
|
|
entry: dict = {
|
|
|
'fromDate': d,
|
|
'fromDate': d,
|