proknow.RtvRequestor

RtvRequestor

class proknow.RtvRequestor.RtvRequestor(base_url, username, password, max_retries=3)

A class used for issuing requests for the RT Visualizer API

get(route, **kwargs)

Issues an HTTP GET request.

Parameters:
  • route (str) – The API route to use in the request.

  • **kwargs (dict, optional) – Additional keyword arguments to pass through in the request.

Returns:

A tuple (res, msg).

  1. res (Response): the Response object

  2. msg (str, dict): the text response or, if the response was JSON, the decoded JSON dictionary.

Return type:

tuple

get_api_version(type=None)

Gets the RT Visualizer’s API version string

Parameters:

type (str) – An optional type such as imageset, structureset, plan, dose, and sro; if not provided, a JSON string representing all available types

Returns:

The API version string.

Return type:

str

get_binary(route, **kwargs)

Issues an HTTP GET request, returning the binary data.

This method is useful when the response is known to not be JSON encoded and should be returned instead as a string of bytes.

Parameters:
  • route (str) – The API route to use in the request.

  • **kwargs (dict, optional) – Additional keyword arguments to pass through in the request.

Returns:

A tuple (res, data).

  1. res (Response): the Response object

  2. data (bytes): The resonse as a byte string

Return type:

tuple

post(route, **kwargs)

Issues an HTTP POST request.

Parameters:
  • route (str) – The API route to use in the request.

  • **kwargs (dict, optional) – Additional keyword arguments to pass through in the request.

Returns:

A tuple (res, msg).

  1. res (Response): the Response object

  2. msg (str, dict): the text response or, if the response was JSON, the decoded JSON dictionary.

Return type:

tuple