import requests

class KittyPostingAPI:
    BASE_URL = "https://kittyposting.com"

    @staticmethod
    def get_random_kitty():
        """
        Fetches a random kitty image URL.
        
        Returns:
            dict: A dictionary containing the image URL.
        """
        response = requests.get(f"{KittyPostingAPI.BASE_URL}/api/get_kitty")
        response.raise_for_status()
        return response.json()

    @staticmethod
    def get_cat_count():
        """
        Fetches the total number of kitty images stored.
        
        Returns:
            dict: A dictionary containing the count of kitty images.
        """
        response = requests.get(f"{KittyPostingAPI.BASE_URL}/api/get_cat_count")
        response.raise_for_status()
        return response.json()

    @staticmethod
    def get_image(filename):
        """
        Fetches the actual image file for a given filename.
        
        Args:
            filename (str): The filename of the image.
        
        Returns:
            bytes: The raw image data.
        """
        response = requests.get(f"{KittyPostingAPI.BASE_URL}/api/image/{filename}")
        response.raise_for_status()
        return response.content

    @staticmethod
    def get_image_data(filename):
        """
        Fetches metadata associated with an image.
        
        Args:
            filename (str): The filename of the image.
        
        Returns:
            dict: A dictionary containing metadata about the image.
        """
        response = requests.get(f"{KittyPostingAPI.BASE_URL}/api/image_data/{filename}")
        response.raise_for_status()
        return response.json()
    
if __name__ == "__main__":
    # Example usage:
    print(KittyPostingAPI.get_random_kitty())
    print(KittyPostingAPI.get_cat_count())
    print(KittyPostingAPI.get_image("e9dbdcd2687c6f0cc5f73b6d902f65490dc53f9302da59025399fd882b01d9ec.jpg"))
    print(KittyPostingAPI.get_image_data("e9dbdcd2687c6f0cc5f73b6d902f65490dc53f9302da59025399fd882b01d9ec.jpg"))
