Exceptions

YFPY module for throwing custom exceptions.

Attributes:
  • logger (Logger) –

    Module level logger for usage and debugging.

YahooFantasySportsException

Bases: Exception

Base YFPY exception class for Yahoo Fantasy Sports API exceptions.

Source code in yfpy/exceptions.py
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
class YahooFantasySportsException(Exception):
    """Base YFPY exception class for Yahoo Fantasy Sports API exceptions.
    """
    def __init__(self, message: str, payload: str = None, url: str = None):
        """Instantiate YFPY exception.

        Args:
            message (str): Human readable string describing the exception.
            payload (str, optional): The API exception error payload.
            url (str, optional): Yahoo Fantasy Sports REST API URL.

        Attributes:
            message (str): Human readable string describing the exception.
            payload (str): The API exception error payload.
            url (str): Yahoo Fantasy Sports REST API URL.

        """
        self.message: str = message
        self.payload: str = payload
        self.url: str = url

    def __str__(self):
        return str(self.message)

__init__

__init__(message, payload=None, url=None)

Instantiate YFPY exception.

Parameters:
  • message (str) –

    Human readable string describing the exception.

  • payload (str, default: None ) –

    The API exception error payload.

  • url (str, default: None ) –

    Yahoo Fantasy Sports REST API URL.

Attributes:
  • message (str) –

    Human readable string describing the exception.

  • payload (str) –

    The API exception error payload.

  • url (str) –

    Yahoo Fantasy Sports REST API URL.

Source code in yfpy/exceptions.py
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
def __init__(self, message: str, payload: str = None, url: str = None):
    """Instantiate YFPY exception.

    Args:
        message (str): Human readable string describing the exception.
        payload (str, optional): The API exception error payload.
        url (str, optional): Yahoo Fantasy Sports REST API URL.

    Attributes:
        message (str): Human readable string describing the exception.
        payload (str): The API exception error payload.
        url (str): Yahoo Fantasy Sports REST API URL.

    """
    self.message: str = message
    self.payload: str = payload
    self.url: str = url

YahooFantasySportsDataNotFound

Bases: YahooFantasySportsException

YFPY exception when no data was retrieved from the Yahoo Fantasy Sports REST API.

Source code in yfpy/exceptions.py
41
42
class YahooFantasySportsDataNotFound(YahooFantasySportsException):
    """YFPY exception when no data was retrieved from the Yahoo Fantasy Sports REST API."""