matrice.rpc module#

Module for RPC client handling Matrice.ai backend API requests.

class matrice.rpc.RPC(access_key, secret_key, project_id=None)[source]#

Bases: object

RPC class for handling backend API requests with token-based authentication.

__init__(access_key, secret_key, project_id=None)[source]#

Initialize the RPC client with optional project ID.

add_project_id(url)[source]#

Add project ID to the URL if present and not already included.

delete(path, headers={}, payload={})[source]#

Send a DELETE request to the specified endpoint.

get(path, params={})[source]#

Send a GET request to the specified endpoint.

post(path, headers={}, payload={}, files=None, data=None)[source]#

Send a POST request to the specified endpoint.

put(path, headers={}, payload={})[source]#

Send a PUT request to the specified endpoint.

refresh_token()[source]#

Refresh the authentication token if expired.

send_request(method, path, headers={}, payload={}, files=None, data=None)[source]#

Send an HTTP request to the specified endpoint.