Skip to content

silent_notifications

Silent Notifications

SilentNotifications #

Bases: BaseNotifications

Silent Notifications

Source code in camply/notifications/silent_notifications.py
class SilentNotifications(BaseNotifications):
    """
    Silent Notifications
    """

    def send_message(self, message: str, **kwargs) -> None:
        """
        Send a message via Email

        Parameters
        ----------
        message: str
            Email Body
        **kwargs
            kwargs are disregarded

        Returns
        -------
        None
        """
        logger.debug(f"SilentNotification: {message}")

    def send_campsites(self, campsites: List[AvailableCampsite], **kwargs):
        """
        Send a message with a campsite object

        Parameters
        ----------
        campsites: List[AvailableCampsite]
        """
        for campsite in campsites:
            campsite_tuple = (
                (
                    f"{campsite.booking_date.strftime('%Y-%m-%d')} - "
                    f"{campsite.booking_end_date.strftime('%Y-%m-%d')}"
                ),
                campsite.campsite_type,
                campsite.campsite_site_name,
                campsite.recreation_area,
                campsite.facility_name,
                campsite.booking_url,
            )
            message_string = "\n\t• " + "\n\t• ".join(campsite_tuple)
            self.send_message(message_string)
            campsite_formatted = pformat(campsite.dict())
            logger.debug("Campsite Info: " + campsite_formatted)

send_campsites(campsites, **kwargs) #

Send a message with a campsite object

Parameters:

Name Type Description Default
campsites List[AvailableCampsite]
required
Source code in camply/notifications/silent_notifications.py
def send_campsites(self, campsites: List[AvailableCampsite], **kwargs):
    """
    Send a message with a campsite object

    Parameters
    ----------
    campsites: List[AvailableCampsite]
    """
    for campsite in campsites:
        campsite_tuple = (
            (
                f"{campsite.booking_date.strftime('%Y-%m-%d')} - "
                f"{campsite.booking_end_date.strftime('%Y-%m-%d')}"
            ),
            campsite.campsite_type,
            campsite.campsite_site_name,
            campsite.recreation_area,
            campsite.facility_name,
            campsite.booking_url,
        )
        message_string = "\n\t• " + "\n\t• ".join(campsite_tuple)
        self.send_message(message_string)
        campsite_formatted = pformat(campsite.dict())
        logger.debug("Campsite Info: " + campsite_formatted)

send_message(message, **kwargs) #

Send a message via Email

Parameters:

Name Type Description Default
message str

Email Body

required
**kwargs

kwargs are disregarded

{}

Returns:

Type Description
None
Source code in camply/notifications/silent_notifications.py
def send_message(self, message: str, **kwargs) -> None:
    """
    Send a message via Email

    Parameters
    ----------
    message: str
        Email Body
    **kwargs
        kwargs are disregarded

    Returns
    -------
    None
    """
    logger.debug(f"SilentNotification: {message}")