Creating a Client

The Client class acts as the means of communicating with a BugZoo server over via its RESTlike API. The client provides a uniform interface for accessing and interacting with the bugs, tools and containers running on the server.

A Client instance may be created to establish a connection to a given server, as shown below. Note that the server needn’t be local; Client can be used to connect to remote BugZoo servers (that may be hosted on a cloud compute platform, such as Amazon EC2, for instance).

import bugzoo

url = "http://127.0.0.1:6060"
client = bugzoo.Client(url)

Client instances can be used to access the resources provided by a BugZoo server (i.e., bugs, containers, and tools). The bugs property exposes a BugManager, which provides access to the bugs registered on the server. The containers property exposes a ContainerManager, which can be used to create, destroy, and interact with containers on the server. The files property exposes a FilesManager, which provides a simple interface for manipulating container file systems (i.e., reading and writing files) and copying files between the host and container.

API Reference

class Client[source]
__init__(base_url: str = None, *, timeout_connection: int = 30) → None[source]

Constructs a new client for communicating with a BugZoo server.

Parameters
  • base_url – the base URL of the BugZoo server.

  • timeout_connection – the maximum number of seconds to wait whilst attempting to connect to the server before declaring the connection to have failed.

Raises

ConnectionFailure – if a connection to the server could not be established within the timeout window.

bugs → BugManager

Provides access to the historical bugs that are registered with the server. Can be used to install, download, and uninstall registered bugs, or to dynamically register new bugs with the server.

containers → ContainerManager

Provides access to the containers running on the server. Can be used to execute tests (as well as arbitrary shell commands), build from source code, apply patches, compute coverage, and more.

files → FileManager

Provides access to the file systems used by running containers. Can be used to read from and write to files in containers, and to copy data between the host machine and a given container.

shutdown() → None[source]

Instructs the connected BugZoo server to shutdown.