Skip to content

URLEnum

src.utils.strings.URLEnum

Bases: Enum

Enum where the value is always a URL object with an HTTPS scheme.

Source code in src\utils\strings.py
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
class URLEnum(Enum, metaclass=URLEnumMeta):
    """Enum where the value is always a URL object with an HTTPS scheme."""

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

    def __truediv__(self, value):
        return self.value / value

    def __getattr__(self, item: str) -> Any:
        """Access anything except _value_, value, and __contains__ from the URL object."""
        if item not in ['_value_', 'value', '__contains__']:
            return self.value.__getattribute__(item)
        return self.__getattribute__(item)