Skip to content

config

Config init file

AppriseConfig #

Apprise Notification Config Class

Source code in camply/config/notification_config.py
class AppriseConfig:
    """
    Apprise Notification Config Class
    """

    APPRISE_URL: str = getenv("APPRISE_URL", None)

CampsiteContainerFields #

String Variable Storage Class

Source code in camply/config/data_columns.py
class CampsiteContainerFields:
    """
    String Variable Storage Class
    """

    CAMPSITE_ID: str = "campsite_id"
    CAMPGROUND_ID: str = "facility_id"
    BOOKING_DATE: str = "booking_date"
    CAMPSITE_GROUP: str = "campsite_group"
    BOOKING_END_DATE: str = "booking_end_date"
    BOOKING_URL: str = "booking_url"
    LOCATION: str = "location"

    PERMITTED_EQUIPMENT: str = "permitted_equipment"
    CAMPSITE_ATTRIBUTES: str = "campsite_attributes"

DataColumns #

Variable Storage Class

Source code in camply/config/data_columns.py
class DataColumns:
    """
    Variable Storage Class
    """

    CAMPSITE_ID_COLUMN: str = "campsite_code"
    BOOKING_DATE_COLUMN: str = "booking_date"
    BOOKING_END_DATE_COLUMN: str = "booking_end_date"
    BOOKING_NIGHTS_COLUMN: str = "booking_nights"
    CAMPSITE_SITE_NAME_COLUMN: str = "campsite_title"
    CAMPSITE_TYPE_COLUMN: str = "campsite_type"
    CAMPSITE_OCCUPANCY_COLUMN: str = "capacity"
    CAMPSITE_USE_TYPE_COLUMN: str = "campsite_type"
    AVAILABILITY_STATUS_COLUMN: str = "Available"
    RECREATION_AREA_COLUMN: str = "recreation_area"
    FACILITY_NAME_COLUMN: str = "facility_name"
    FACILITY_ID_COLUMN: str = "facility_id"
    BOOKING_URL_COLUMN: str = "booking_url"

EmailConfig #

Email Notification Config Class

Source code in camply/config/notification_config.py
class EmailConfig:
    """
    Email Notification Config Class
    """

    EMAIL_TO_ADDRESS: Optional[str] = getenv("EMAIL_TO_ADDRESS", None)
    DEFAULT_FROM_ADDRESS: str = "[email protected]"
    EMAIL_FROM_ADDRESS: str = getenv("EMAIL_FROM_ADDRESS", DEFAULT_FROM_ADDRESS)
    DEFAULT_SUBJECT_LINE: str = "Camply Notification"
    EMAIL_SUBJECT_LINE: str = getenv("EMAIL_SUBJECT_LINE", DEFAULT_SUBJECT_LINE)
    DEFAULT_SMTP_SERVER: str = "smtp.gmail.com"
    EMAIL_SMTP_SERVER: str = getenv("EMAIL_SMTP_SERVER", DEFAULT_SMTP_SERVER)
    EMAIL_USERNAME: Optional[str] = getenv("EMAIL_USERNAME", None)
    EMAIL_PASSWORD: Optional[str] = getenv("EMAIL_PASSWORD", None)
    DEFAULT_SMTP_PORT: int = 465
    EMAIL_SMTP_PORT: int = int(getenv("EMAIL_SMTP_PORT", DEFAULT_SMTP_PORT))

    ENVIRONMENT_VARIABLE_NAMES: List[str] = [
        "EMAIL_TO_ADDRESS",
        "EMAIL_USERNAME",
        "EMAIL_PASSWORD",
    ]
    OPTIONAL_ENVIRONMENT_VARIABLE: List[str] = [
        f"EMAIL_SMTP_SERVER (default: {DEFAULT_SMTP_SERVER})",
        f"EMAIL_FROM_ADDRESS (default: {DEFAULT_FROM_ADDRESS})",
        f'EMAIL_SUBJECT_LINE (default: "{DEFAULT_SUBJECT_LINE}")',
        f"EMAIL_SMTP_PORT (default: {DEFAULT_SMTP_PORT})",
    ]

EquipmentOptions #

Bases: str, Enum

Enumeration of the Equipment Options

Source code in camply/config/search_config.py
class EquipmentOptions(str, Enum):
    """
    Enumeration of the Equipment Options
    """

    tent = "tent"
    rv = "rv"
    trailer = "trailer"
    vehicle = "vehicle"
    other = "other"

    __all_accepted_equipment__ = [tent, rv, trailer, vehicle]

FileConfig #

File Path Storage Class

Source code in camply/config/file_config.py
class FileConfig:
    """
    File Path Storage Class
    """

    HOME_PATH = abspath(Path.home())
    DOT_CAMPLY_FILE = join(HOME_PATH, ".camply")
    _file_config_file = Path(abspath(__file__))
    _config_dir = _file_config_file.parent

    CAMPLY_DIRECTORY = _config_dir.parent
    ROOT_DIRECTORY = CAMPLY_DIRECTORY.parent

    DOT_CAMPLY_FIELDS = OrderedDict(
        PUSHOVER_PUSH_USER={"default": "", "notes": "Enables Pushover Notifications"},
        PUSHBULLET_API_TOKEN={
            "default": "",
            "notes": "Enables Pushbullet Notifications",
        },
        SLACK_WEBHOOK={"default": "", "notes": "Enables Slack Notifications"},
        TELEGRAM_BOT_TOKEN={"default": "", "notes": "Enables Telegram Notifications"},
        TELEGRAM_CHAT_ID={
            "default": "",
            "notes": "Telegram Notification will be sent here",
        },
        TWILIO_ACCOUNT_SID={"default": "", "notes": "Twilio Account SID"},
        TWILIO_AUTH_TOKEN={"default": "", "notes": "Twilio Auth Token"},
        TWILIO_SOURCE_NUMBER={
            "default": "",
            "notes": "Twilio Source number. E.164 format",
        },
        TWILIO_DEST_NUMBERS={
            "default": "",
            "notes": "Comma-separated list of phone numbers.",
        },
        EMAIL_TO_ADDRESS={
            "default": "",
            "notes": "Email Notifications will be sent here",
        },
        EMAIL_USERNAME={"default": "", "notes": "Email Authorization Login Username"},
        EMAIL_PASSWORD={"default": "", "notes": "Email Authorization Login Password"},
        EMAIL_SMTP_SERVER={
            "default": "smtp.gmail.com",
            "notes": "Email Authorization SMTP Server Address",
        },
        EMAIL_SMTP_PORT={
            "default": 465,
            "notes": "Email Authorization SMTP Server Port",
        },
        EMAIL_FROM_ADDRESS={
            "default": "[email protected]",
            "notes": "Email Notifications Will Come From this Email",
        },
        EMAIL_SUBJECT_LINE={
            "default": "Camply Notification",
            "notes": "Email Notifications Will Have This Subject Line",
        },
        PUSHOVER_PUSH_TOKEN={
            "default": "",
            "notes": "Pushover Notifications From Your Custom App " "(not required)",
        },
        NTFY_TOPIC={
            "default": "",
            "notes": "NTFY Notification Topic",
        },
        APPRISE_URL={"default": "", "notes": "Apprise notification URL"},
        WEBHOOK_URL={"default": "", "notes": "Webhook URL"},
        WEBHOOK_HEADERS={"default": "", "notes": "Webhook JSON Headers"},
        RIDB_API_KEY={
            "default": "",
            "notes": "Personal Recreation.gov API Key (not required)",
        },
    )

    PROVIDERS_DIRECTORY = CAMPLY_DIRECTORY.joinpath("providers")
    RESERVE_CALIFORNIA_PROVIDER = PROVIDERS_DIRECTORY.joinpath("reserve_california")
    USEDIRECT_PROVIDER = PROVIDERS_DIRECTORY.joinpath("usedirect")

NtfyConfig #

Ntfy Notification Config Class

Source code in camply/config/notification_config.py
class NtfyConfig:
    """
    Ntfy Notification Config Class
    """

    NTFY_API_ENDPOINT: str = "https://ntfy.sh/"
    NTFY_TOPIC = getenv("NTFY_TOPIC", None)

PushbulletConfig #

Pushbullet Notification Config Class

Source code in camply/config/notification_config.py
class PushbulletConfig:
    """
    Pushbullet Notification Config Class
    """

    PUSHBULLET_API_ENDPOINT: str = "https://api.pushbullet.com/v2/pushes"
    API_HEADERS: dict = {"Content-Type": "application/json"}

    API_TOKEN = getenv("PUSHBULLET_API_TOKEN", None)

PushoverConfig #

Pushover Notification Config Class

Source code in camply/config/notification_config.py
class PushoverConfig:
    """
    Pushover Notification Config Class
    """

    PUSHOVER_API_ENDPOINT: str = "https://api.pushover.net/1/messages.json"
    PUSHOVER_DEFAULT_API_TOKEN: bytes = b"YXBqOWlzNjRrdm5zZWt3YmEyeDZxaDV0cWhxbXI5"
    API_HEADERS: dict = {"Content-Type": "application/json"}

    PUSH_TOKEN: str = getenv("PUSHOVER_PUSH_TOKEN", None)
    PUSH_USER: str = getenv("PUSHOVER_PUSH_USER", None)

RIDBConfig #

Bases: APIConfig

RIDB API Configuration

https://ridb.recreation.gov/docs

Source code in camply/config/api_config.py
class RIDBConfig(APIConfig):
    """
    RIDB API Configuration

    https://ridb.recreation.gov/docs
    """

    _camply_ridb_service_account_api_token: bytes = (
        b"YTc0MTY0NzEtMWI1ZC00YTY0LWFkM2QtYTIzM2U3Y2I1YzQ0"
    )
    _api_key: Union[str, bytes] = getenv(
        "RIDB_API_KEY", _camply_ridb_service_account_api_token
    )
    API_KEY = _camply_ridb_service_account_api_token if _api_key == "" else _api_key

    RIDB_SCHEME: str = "https"
    RIDB_NET_LOC: str = "ridb.recreation.gov"
    RIDB_BASE_PATH: str = "api/v1/"

    # FACILITIES_API_PATH FIELDS
    FACILITIES_API_PATH: str = "facilities"
    CAMPGROUND_FACILITY_FIELD_QUALIFIER: str = "Campground"
    TICKET_FACILITY_FIELD_QUALIFIER: str = "Ticket Facility"
    TIMED_ENTRY_FACILITY_FIELD_QUALIFIER: str = "Timed Entry"
    # RECREATION AREA FIELDS
    REC_AREA_API_PATH: str = "recareas"
    # CAMPSITE DETAILS
    CAMPSITE_API_PATH: str = "campsites"
    # TOUR DETAILS
    TOUR_API_PATH: str = "tours"

RecreationBookingConfig #

Bases: APIConfig

Variable Storage Class for Recreation.gov Booking API

Source code in camply/config/api_config.py
class RecreationBookingConfig(APIConfig):
    """
    Variable Storage Class for Recreation.gov Booking API
    """

    API_SCHEME: str = "https"
    API_NET_LOC = "www.recreation.gov"
    API_BASE_PATH: str = "api/camps/availability/campground/"
    API_MONTH_PATH: str = "month"
    API_REFERRERS: Dict[str, Any] = {"Referer": "https://www.recreation.gov/"}

    CAMPSITE_UNAVAILABLE_STRINGS: list = [
        "Reserved",
        "Not Available",
        "Not Reservable",
        "Not Reservable Management",
        "Not Available Cutoff",
        "Lottery",
        "Open",
        "NYR",
        "Closed",
    ]

    CAMPSITE_LOCATION_LOOP_DEFAULT: str = "Default Loop"
    CAMPSITE_LOCATION_SITE_DEFAULT: str = "Default Site"

    CAMPSITE_BOOKING_URL: str = "https://www.recreation.gov/camping/campsites"

    RATE_LIMITING = (1.01, 1.51)

SearchConfig #

File Path Storage Class

Source code in camply/config/search_config.py
class SearchConfig:
    """
    File Path Storage Class
    """

    POLLING_INTERVAL_MINIMUM: int = 5  # 5 MINUTES
    RECOMMENDED_POLLING_INTERVAL: int = 10  # 10 MINUTES
    ERROR_MESSAGE: str = "No search days configured. Exiting"
    MINIMUM_CAMPSITES_FIRST_NOTIFY: int = 5
    MAXIMUM_NOTIFICATION_BATCH_SIZE: int = 20

SlackConfig #

Slack Notification Config Class

Source code in camply/config/notification_config.py
class SlackConfig:
    """
    Slack Notification Config Class
    """

    SLACK_WEBHOOK: Optional[str] = getenv("SLACK_WEBHOOK", None)

TelegramConfig #

Telegram Notification Config Class

Source code in camply/config/notification_config.py
class TelegramConfig:
    """
    Telegram Notification Config Class
    """

    BOT_TOKEN = getenv("TELEGRAM_BOT_TOKEN", None)
    CHAT_ID = getenv("TELEGRAM_CHAT_ID", None)

    API_ENDPOINT: str = f"https://api.telegram.org/bot{BOT_TOKEN}/sendMessage"
    API_HEADERS: dict = {"Content-Type": "application/json"}
    API_CONTENT: dict = {
        "chat_id": CHAT_ID,
        "parse_mode": "MarkdownV2",
        "disable_web_page_preview": "true",
    }

TwilioConfig #

Twilio Notification Config Class

Source code in camply/config/notification_config.py
class TwilioConfig:
    """
    Twilio Notification Config Class
    """

    ACCOUNT_SID = getenv("TWILIO_ACCOUNT_SID", None)
    AUTH_TOKEN = getenv("TWILIO_AUTH_TOKEN", None)
    SOURCE_NUMBER = getenv("TWILIO_SOURCE_NUMBER", None)
    # comma separated set of phone numbers
    DEST_NUMBERS = getenv("TWILIO_DEST_NUMBERS", None)

YellowstoneConfig #

Bases: DataColumns, APIConfig

Variable Storage Class

Source code in camply/config/api_config.py
class YellowstoneConfig(DataColumns, APIConfig):
    """
    Variable Storage Class
    """

    API_SCHEME: str = "https"
    API_BASE_ENDPOINT: str = "webapi.xanterra.net"
    API_BASE_PATH: str = "v1/api"
    LODGING_PATH: str = f"/{API_BASE_PATH}/availability/hotels"
    YELLOWSTONE_PARK_PATH: str = "yellowstonenationalparklodges"
    YELLOWSTONE_LODGING_PATH: str = f"{LODGING_PATH}/{YELLOWSTONE_PARK_PATH}"
    CAMPSITE_AVAILABILITY: str = f"{API_BASE_PATH}/availability/rooms"
    YELLOWSTONE_CAMPSITE_AVAILABILITY: str = (
        f"{CAMPSITE_AVAILABILITY}/{YELLOWSTONE_PARK_PATH}"
    )
    YELLOWSTONE_PROPERTY_INFO: str = (
        f"{API_BASE_PATH}/property/rooms/{YELLOWSTONE_PARK_PATH}"
    )
    API_REFERRERS: dict = {
        "Host": "webapi.xanterra.net",
        "Origin": "https://secure.yellowstonenationalparklodges.com",
        "Referer": "https://secure.yellowstonenationalparklodges.com/",
    }

    LODGING_CAMPGROUND_QUALIFIER: str = ":RV"

    # JSON FILTERING
    BOOKING_AVAILABILITY: str = "availability"

    # DATAFRAME FILTERING
    FACILITY_ID: str = "facility_id"
    FACILITY_STATUS: str = "status"
    FACILITY_STATUS_QUALIFIER: str = "OPEN"
    FACILITY_ROOMS: str = "rooms"
    FACILITY_AVAILABLE_QUALIFIER: str = "available"
    FACILITY_HOTEL_CODE: str = "hotelCode"
    FACILITY_ROOM_CODE: str = "roomCode"
    FACILITY_PRICE: str = "price"
    FACILITY_TYPE: str = "type"

    CAMPSITE_DATA_COLUMNS: List[str] = ["facility_id", "facility_name", "booking_url"]

    RATE_CODE: str = "INTERNET"
    LODGING_RATES: str = "rates"
    LODGING_TITLE: str = "title"
    LODGING_BASE_PRICES: str = "mins"
    LODGING_OCCUPANCY_BASE: str = "occupancyBase"
    LODGING_OCCUPANCY_MAX: str = "occupancyMax"
    LODGING_ERROR_MESSAGE: str = "message"

    MINIMUM_POLLING_INTERVAL: int = 45

    WEBUI_ALIAS_ENDPOINT: str = "yellowstonenationalparklodges.com"
    WEBUI_BASE_ENDPOINT: str = "secure.yellowstonenationalparklodges.com"
    WEBUI_BOOKING_PATH: str = "booking/lodging-select"

    YELLOWSTONE_RECREATION_AREA_ID: int = 1
    YELLOWSTONE_RECREATION_AREA_NAME: str = "Yellowstone"
    YELLOWSTONE_RECREATION_AREA_FULL_NAME: str = "Yellowstone National Park"
    YELLOWSTONE_RECREATION_AREA_FORMAL_NAME: str = "Yellowstone National Park, USA"
    YELLOWSTONE_LOOP_NAME: str = "N/A"
    CAMPSITE_AVAILABILITY_STATUS: str = "Available"
    YELLOWSTONE_CAMPGROUND_NAME_REPLACE: Tuple[str, str] = (
        "CG Internet Rate",
        "Campground",
    )

    YELLOWSTONE_TIMEZONE: str = "America/Denver"

    # LODGES:  https://webapi.xanterra.net/v1/api/property/hotels/yellowstonenationalparklodges
    YELLOWSTONE_CAMPGROUNDS: Dict[str, str] = {
        "YLYC:RV": "Canyon Campground",
        "YLYB:RV": "Bridge Bay Campground",
        "YLYG:RV": "Grant Campground",
        "YLYM:RV": "Madison Campground",
        "YLYF:RV": "Fishing Bridge RV Park",
    }

    YELLOWSTONE_CAMPGROUND_OBJECTS: List[CampgroundFacility] = []
    for key, value in YELLOWSTONE_CAMPGROUNDS.items():
        YELLOWSTONE_CAMPGROUND_OBJECTS.append(
            CampgroundFacility(
                recreation_area_id=YELLOWSTONE_RECREATION_AREA_ID,
                recreation_area=YELLOWSTONE_RECREATION_AREA_FORMAL_NAME,
                facility_name=value,
                facility_id=str(key),
            )
        )