def __init__(self, endpoint: str): self.endpoint = endpoint.split("/api", maxsplit=1)[-1] config = c.check_get_config() self.url = up.urljoin(config.server, f"api{self.endpoint}") # check if access to the resource is allowed self._check_endpoint(self.url) self.session.headers.update(Authorization=f"Token {config.token}", Datapane_API_Version=__version__)
def __init__(self, endpoint: str): # drop /api if exists # TODO - use furl for paths here self.endpoint = endpoint.split("/api", maxsplit=1)[-1] config = c.check_get_config() self.url = up.urljoin(config.server, f"api{self.endpoint}") # check if access to the resource is allowed self._check_endpoint(self.url) self.session.headers.update({ "Authorization": f"Token {config.token}", "Datapane-API-Version": __version__ })