import requests


class GatewayClient:
    """
    Lightweight client for communicating with the Explorer Gateway.

    This class knows where the gateway lives and performs HTTP GET
    requests. Higher-level Explorer systems build on top of this.
    """

    def __init__(self, base_url):
        self.base_url = base_url.rstrip("/")

    def get(self, endpoint, **params):
        """
        Call a gateway endpoint and return decoded JSON.
        """

        url = f"{self.base_url}/{endpoint.lstrip('/')}"

        params["token"] = "forGPTforknow@123"

        response = requests.get(
            url,
            params=params,
            timeout=10
        )

        response.raise_for_status()

        return response.json()