Skip to content

Module isilon.api.endpoints

View Source
import attr

from isilon.api.base import BaseAPI

@attr.s(frozen=True)

class Endpoints(BaseAPI):

    async def __call__(self, headers: dict = {}, **kwargs):

        """List endpoints."""

        response = await self.base_request(

            self.http.get,

            f"{self.url}/{self.API_VERSION}/endpoints",

            headers=headers,

            **kwargs,

        )

        return response.status

Classes

Endpoints

class Endpoints(
    http: isilon.http.Http,
    url,
    credentials: isilon.creds.Credentials
)
View Source
class Endpoints(BaseAPI):

    async def __call__(self, headers: dict = {}, **kwargs):

        """List endpoints."""

        response = await self.base_request(

            self.http.get,

            f"{self.url}/{self.API_VERSION}/endpoints",

            headers=headers,

            **kwargs,

        )

        return response.status

Ancestors (in MRO)

  • isilon.api.base.BaseAPI

Class variables

API_VERSION

Methods

base_request
def base_request(
    self,
    fn,
    url,
    headers: dict = {},
    *args,
    **kwargs
)
View Source
    async def base_request(self, fn, url, headers: dict = {}, *args, **kwargs):

        headers = await self.get_token(headers)

        response = await fn(url, headers=headers, *args, **kwargs)

        return response
get_token
def get_token(
    self,
    headers: dict
) -> dict
View Source
    async def get_token(self, headers: dict) -> dict:

        token = await self.credentials.x_auth_token(self.url)

        headers.update(token)

        return headers