mate_rest_client package

Python APIs and models for interacting with MATE’s REST API.

class mate_rest_client.Client(base: str = 'http://localhost:8666')

Bases: object

The top-level Python client for MATE’s REST API.

Users can interact with subcomponents of the MATE REST API via attributes on any Client instance:

  • client.artifacts (artifacts.ArtifactRoutes): interactions with artifacts

  • client.builds (artifacts.BuildRoutes): interactions with builds

  • client.compilations (artifacts.CompilationRoutes): interactions with compilations

  • client.analyses (artifacts.AnalysisRoutes): interactions with analyses

  • client.pois (artifacts.POIRoutes): interactions with POIs

  • client.graphs (artifacts.GraphRoutes): interactions with graphs

  • client.manticore (artifacts.ManticoreRoutes): interactions with Manticore tasks

Client instances can also make direct requests via Client.get(), Client.post(), and Client.delete(). This interface should be considered lower-level and not preferred.

Parameters

base (str) –

Return type

None

delete(path: str, **kwargs: Dict[str, Any]) requests.Response
Parameters
  • path (str) –

  • kwargs (Dict[str, Any]) –

Return type

requests.Response

delete_as(model: Type[_Model], path: str, **kwargs: Dict[str, Any]) _Model
Parameters
  • model (Type[_Model]) –

  • path (str) –

  • kwargs (Dict[str, Any]) –

Return type

_Model

delete_as_maybe(model: Type[_Model], path: str, **kwargs: Dict[str, Any]) Optional[_Model]
Parameters
  • model (Type[_Model]) –

  • path (str) –

  • kwargs (Dict[str, Any]) –

Return type

Optional[_Model]

get(path: str, **kwargs: Dict[str, Any]) requests.Response
Parameters
  • path (str) –

  • kwargs (Dict[str, Any]) –

Return type

requests.Response

get_as(model: Type[_Model], path: str, **kwargs: Dict[str, Any]) _Model
Parameters
  • model (Type[_Model]) –

  • path (str) –

  • kwargs (Dict[str, Any]) –

Return type

_Model

get_as_maybe(model: Type[_Model], path: str, **kwargs: Dict[str, Any]) Optional[_Model]
Parameters
  • model (Type[_Model]) –

  • path (str) –

  • kwargs (Dict[str, Any]) –

Return type

Optional[_Model]

patch(path: str, **kwargs: Dict[str, Any]) requests.Response
Parameters
  • path (str) –

  • kwargs (Dict[str, Any]) –

Return type

requests.Response

patch_as(model: Type[_Model], path: str, **kwargs: Dict[str, Any]) _Model
Parameters
  • model (Type[_Model]) –

  • path (str) –

  • kwargs (Dict[str, Any]) –

Return type

_Model

patch_as_maybe(model: Type[_Model], path: str, **kwargs: Dict[str, Any]) Optional[_Model]
Parameters
  • model (Type[_Model]) –

  • path (str) –

  • kwargs (Dict[str, Any]) –

Return type

Optional[_Model]

post(path: str, **kwargs: Dict[str, Any]) requests.Response
Parameters
  • path (str) –

  • kwargs (Dict[str, Any]) –

Return type

requests.Response

post_as(model: Type[_Model], path: str, **kwargs: Dict[str, Any]) _Model
Parameters
  • model (Type[_Model]) –

  • path (str) –

  • kwargs (Dict[str, Any]) –

Return type

_Model

post_as_maybe(model: Type[_Model], path: str, **kwargs: Dict[str, Any]) Optional[_Model]
Parameters
  • model (Type[_Model]) –

  • path (str) –

  • kwargs (Dict[str, Any]) –

Return type

Optional[_Model]

put(path: str, **kwargs: Dict[str, Any]) requests.Response
Parameters
  • path (str) –

  • kwargs (Dict[str, Any]) –

Return type

requests.Response

put_as(model: Type[_Model], path: str, **kwargs: Dict[str, Any]) _Model
Parameters
  • model (Type[_Model]) –

  • path (str) –

  • kwargs (Dict[str, Any]) –

Return type

_Model

put_as_maybe(model: Type[_Model], path: str, **kwargs: Dict[str, Any]) Optional[_Model]
Parameters
  • model (Type[_Model]) –

  • path (str) –

  • kwargs (Dict[str, Any]) –

Return type

Optional[_Model]

exception mate_rest_client.RestError(status_code: StatusCode, reason: str, url: Url)

Bases: Exception

Raised when a request or other operation internal to the REST client fails.

Parameters
  • status_code (StatusCode) –

  • reason (str) –

  • url (Url) –

Return type

None

classmethod from_(resp: requests.models.Response) mate_rest_client.RestError

Create a RestError from the given requests.Response.

Assumes that the request.Response is an error response.

Parameters

resp (requests.models.Response) –

Return type

mate_rest_client.RestError

reason: str
status_code: StatusCode
url: Url