Fixed some linting stuff
This commit is contained in:
@@ -11,7 +11,7 @@ import re
|
||||
from abc import ABC
|
||||
from dataclasses import dataclass
|
||||
from datetime import datetime
|
||||
from enum import Enum, IntEnum
|
||||
from enum import Enum
|
||||
from typing import Any, Optional, override
|
||||
|
||||
from xsdata.formats.dataclass.serializers.config import SerializerConfig
|
||||
@@ -23,6 +23,7 @@ from alpine_bits_python.alpine_bits_helpers import (
|
||||
)
|
||||
from alpine_bits_python.logging_config import get_logger
|
||||
|
||||
from .const import HttpStatusCode
|
||||
from .db import Customer, Reservation
|
||||
from .generated.alpinebits import (
|
||||
OtaNotifReportRq,
|
||||
@@ -38,15 +39,6 @@ from .reservation_service import ReservationService
|
||||
_LOGGER = get_logger(__name__)
|
||||
|
||||
|
||||
class HttpStatusCode(IntEnum):
|
||||
"""Allowed HTTP status codes for AlpineBits responses."""
|
||||
|
||||
OK = 200
|
||||
BAD_REQUEST = 400
|
||||
UNAUTHORIZED = 401
|
||||
INTERNAL_SERVER_ERROR = 500
|
||||
|
||||
|
||||
def dump_json_for_xml(json_content: Any) -> str:
|
||||
"""Dump JSON content as a pretty-printed string for embedding in XML.
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ from .alpinebits_server import (
|
||||
)
|
||||
from .auth import generate_unique_id, validate_api_key
|
||||
from .config_loader import load_config
|
||||
from .const import HttpStatusCode
|
||||
from .customer_service import CustomerService
|
||||
from .db import Base, get_database_url
|
||||
from .db import Customer as DBCustomer
|
||||
@@ -147,7 +148,7 @@ async def push_listener(customer: DBCustomer, reservation: DBReservation, hotel)
|
||||
version=Version.V2024_10,
|
||||
)
|
||||
|
||||
if request.status_code != 200:
|
||||
if request.status_code != HttpStatusCode.OK:
|
||||
_LOGGER.error(
|
||||
"Failed to generate push request for hotel %s, reservation %s: %s",
|
||||
hotel_id,
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
from enum import IntEnum
|
||||
from typing import Final
|
||||
|
||||
|
||||
class HttpStatusCode(IntEnum):
|
||||
"""Allowed HTTP status codes for AlpineBits responses."""
|
||||
|
||||
OK = 200
|
||||
BAD_REQUEST = 400
|
||||
UNAUTHORIZED = 401
|
||||
INTERNAL_SERVER_ERROR = 500
|
||||
|
||||
|
||||
RESERVATION_ID_TYPE: str = (
|
||||
"13" # Default reservation ID type for Reservation. 14 would be cancellation
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user