The BrainFrameAPI Class

The BrainFrameAPI class holds methods corresponding to all API endpoints that the server provides. In order to get connected to a BrainFrame server, start by initializing a new instance of this class.

from brainframe.api import BrainFrameAPI

# Log into a local BrainFrame server instance with the default admin
# credentials
api = BrainFrameAPI("http://localhost", ("admin", "admin"))

Take a look at the next few topics for information on all the methods the BrainFrameAPI class has available and their corresponding data structures.

Basic Methods

class BrainFrameAPI(server_url=None, credentials: Tuple[str, str] = None)

Provides access to BrainFrame API endpoints.

Parameters
  • server_url – The URL of the BrainFrame instance to connect to. If None, it needs to be set later with set_url before use

  • credentials – The username and password as a tuple. Used to authenticate with the server. If None, no authentication information will be provided.

close()

Clean up the API. It may no longer be used after this call.

version(timeout=30) → str
Returns

The current BrainFrame version in the format X.Y.Z

wait_for_server_initialization(timeout: float = None)

Waits for the server to be ready to handle requests.

Parameters

timeout – The maximum amount of time, in seconds, to wait for the server to start. If None, this method will wait indefinitely.