Transceiver
- class sentrypy.transceiver.PaginationLink(url: str, results: bool, rel: str | None = None, cursor: str | None = None)
- classmethod from_header(header: Dict, direction: str) PaginationLink
Parses the response header and returns previous or next pagination link
- sentrypy.transceiver.ResponseAttribute(value)
alias of
ResponseContent
- class sentrypy.transceiver.Transceiver(token: str)
- delete(endpoint: str)
Perform authenticated delete request and return HTTP response
- get(endpoint: str, *, params: Dict | None = None, response_attribute: ResponseContent | None = ResponseContent.JSON, model: type | None = None, **kwargs)
Perform authenticated get request and return selected attribute of HTTP response
- Parameters:
endpoint – Where to send the get request
params – Parameters to add to endpoint
response_attribute – Which part of the HTTP response to return
model – If response_attribute is JSON, which class to instantiate
**kwargs – Additional arguments for model class constructor
- paginate_get(endpoint, *, params: Dict | None = None, model: type | None = None, max_results: int | None = None, **kwargs) Iterator
Paginate endpoint and generate model instances
- Parameters:
endpoint – The URL to send a get request to
params – Parameters to append to endpoint url
model – Instantiates objects from this class
max_results – Return no more objects, unlimited by default
**kwargs – Additional arguments for model class constructor
- post(endpoint: str, *, data: Dict | None = None, response_attribute: ResponseContent | None = ResponseContent.JSON, model: type | None = None, **kwargs)
Perform authenticated post request and return selected attribute of HTTP response
- Parameters:
endpoint – Where to send the get request
data – Body parameter / payload to send to endpoint
response_attribute – Which part of the HTTP response to return
model – If response_attribute is JSON, which class to instantiate
**kwargs – Additional arguments for model class constructor
- put(endpoint: str, *, params: Dict | None = None, data: Dict | None = None, response_attribute: ResponseContent | None = ResponseContent.JSON, model: type | None = None, **kwargs)
Perform authenticated post request and return selected attribute of HTTP response
- Parameters:
endpoint – Where to send the get request
params – Parameters to append to endpoint url
data – Body parameter / payload to send to endpoint
response_attribute – Which part of the HTTP response to return
model – If response_attribute is JSON, which class to instantiate
**kwargs – Additional arguments for model class constructor