# Path: cassiopeia/datastores/common.py
#     USE_PYCURL = True
#     USE_PYCURL = False
# class HTTPError(RuntimeError):
#     class HTTPClient(object):
#     class HTTPClient(object):
#     def __init__(self, message, code, response_headers: Dict[str, str] = None):
#         def _execute(curl: Curl, close_connection: bool) -> int:
#         def _get(
#             url: str,
#             headers: Mapping[str, str] = None,
#             rate_limiters: List[RateLimiter] = None,
#             connection: Curl = None,
#         ) -> (int, bytes, dict):
#             def get_response_headers(header_line: bytes) -> None:
#         def get(
#             self,
#             url: str,
#             parameters: MutableMapping[str, Any] = None,
#             headers: Mapping[str, str] = None,
#             rate_limiters: List[RateLimiter] = None,
#             connection: Curl = None,
#             encode_parameters: bool = True,
#         ) -> (Union[dict, list, str, bytes], dict):
#         def new_session(self) -> Curl:
#         def _get(
#             url: str,
#             headers: Mapping[str, str] = None,
#             rate_limiters: List[RateLimiter] = None,
#         ) -> (int, bytes, dict):
#         def get(
#             self,
#             url: str,
#             parameters: MutableMapping[str, Any] = None,
#             headers: Mapping[str, str] = None,
#             rate_limiters: List[RateLimiter] = None,
#             connection: Curl = None,
#             encode_parameters: bool = True,
#         ) -> (Union[dict, list, str, bytes], dict):
#         def new_session(self) -> requests.Session:
# 
# Path: cassiopeia/datastores/riotapi/common.py
# class APIForbiddenError(APINotFoundError):
#     pass
# 
# class APINotFoundError(HTTPError):
#     pass
# 
# class APIRequestError(HTTPError):
#     pass
# 
# class APIError(HTTPError):
#     pass
# 
# _ERROR_CODES = {
#     400: APIRequestError,
#     401: APIForbiddenError,
#     403: APIRequestError,
#     404: APINotFoundError,
#     415: RuntimeError,
#     429: RuntimeError,
#     500: APIError,
#     502: APIError,
#     503: APIError,
#     504: APIError,
# }


from abc import abstractmethod
from typing import MutableMapping, Any, Union, TypeVar, Iterable, Type
from datapipelines import DataSource, PipelineContext
from ..common import HTTPClient, HTTPError, Curl
from ..riotapi.common import (
    APIForbiddenError,
    APINotFoundError,
    APIRequestError,
    APIError,
    _ERROR_CODES,
)
from ...dto.staticdata.realm import RealmDto
    import ujson as json
    import json
        self,
        endpoint: str,
        parameters: MutableMapping[str, Any] = None,
        connection: Curl = None,
    ) -> Union[dict, list, Any]:
        url = f"{self._server_url}:{self._port}/{endpoint}"
        try:
            result, headers = self._client.get(
                url=url, parameters=parameters, connection=connection
            )

            # Ensure compatibility with both Curl and Requests based clients
            if isinstance(result, bytes):
                result = json.loads(result.decode())
            elif isinstance(result, str):
                result = json.loads(result)

            if not isinstance(result, (dict, list)):
                raise ValueError(
                    "Unexpected type returned from HTTPClient: {}".format(type(result))
                )
        except HTTPError as error:
            # The error handlers didn't work, so raise an appropriate error.
            new_error_type = _ERROR_CODES[error.code]
            if new_error_type is RuntimeError:
                new_error = RuntimeError(
                    'Encountered an HTTP error code {code} with message "{message}" which should have already been handled. Report this to the Cassiopeia team.'.format(
                        code=error.code, message=str(error)
                    )
                )

# Path: cassiopeia/datastores/common.py
#     USE_PYCURL = True
#     USE_PYCURL = False
# class HTTPError(RuntimeError):
#     class HTTPClient(object):
#     class HTTPClient(object):
#     def __init__(self, message, code, response_headers: Dict[str, str] = None):
#         def _execute(curl: Curl, close_connection: bool) -> int:
#         def _get(
#             url: str,
#             headers: Mapping[str, str] = None,
#             rate_limiters: List[RateLimiter] = None,
#             connection: Curl = None,
#         ) -> (int, bytes, dict):
#             def get_response_headers(header_line: bytes) -> None:
#         def get(
#             self,
#             url: str,
#             parameters: MutableMapping[str, Any] = None,
#             headers: Mapping[str, str] = None,
#             rate_limiters: List[RateLimiter] = None,
#             connection: Curl = None,
#             encode_parameters: bool = True,
#         ) -> (Union[dict, list, str, bytes], dict):
#         def new_session(self) -> Curl:
#         def _get(
#             url: str,
#             headers: Mapping[str, str] = None,
#             rate_limiters: List[RateLimiter] = None,
#         ) -> (int, bytes, dict):
#         def get(
#             self,
#             url: str,
#             parameters: MutableMapping[str, Any] = None,
#             headers: Mapping[str, str] = None,
#             rate_limiters: List[RateLimiter] = None,
#             connection: Curl = None,
#             encode_parameters: bool = True,
#         ) -> (Union[dict, list, str, bytes], dict):
#         def new_session(self) -> requests.Session:
# 
# Path: cassiopeia/datastores/riotapi/common.py
# class APIForbiddenError(APINotFoundError):
#     pass
# 
# class APINotFoundError(HTTPError):
#     pass
# 
# class APIRequestError(HTTPError):
#     pass
# 
# class APIError(HTTPError):
#     pass
# 
# _ERROR_CODES = {
#     400: APIRequestError,
#     401: APIForbiddenError,
#     403: APIRequestError,
#     404: APINotFoundError,
#     415: RuntimeError,
#     429: RuntimeError,
#     500: APIError,
#     502: APIError,
#     503: APIError,
#     504: APIError,
# }


# Path: cassiopeia/datastores/kernel/common.py
from abc import abstractmethod
from typing import MutableMapping, Any, Union, TypeVar, Iterable, Type
from datapipelines import DataSource, PipelineContext
from ..common import HTTPClient, HTTPError, Curl
from ..riotapi.common import (
    APIForbiddenError,
    APINotFoundError,
    APIRequestError,
    APIError,
    _ERROR_CODES,
)
from ...dto.staticdata.realm import RealmDto
    import ujson as json
    import json

        self,
        endpoint: str,
        parameters: MutableMapping[str, Any] = None,
        connection: Curl = None,
    ) -> Union[dict, list, Any]:
        url = f"{self._server_url}:{self._port}/{endpoint}"
        try:
            result, headers = self._client.get(
                url=url, parameters=parameters, connection=connection
            )

            # Ensure compatibility with both Curl and Requests based clients
            if isinstance(result, bytes):
                result = json.loads(result.decode())
            elif isinstance(result, str):
                result = json.loads(result)

            if not isinstance(result, (dict, list)):
                raise ValueError(
                    "Unexpected type returned from HTTPClient: {}".format(type(result))
                )
        except HTTPError as error:
            # The error handlers didn't work, so raise an appropriate error.
            new_error_type = _ERROR_CODES[error.code]
            if new_error_type is RuntimeError:
                new_error = RuntimeError(
                    'Encountered an HTTP error code {code} with message "{message}" which should have already been handled. Report this to the Cassiopeia team.'.format(
                        code=error.code, message=str(error)
                    )
                )

            elif new_error_type is APIError: