relevanceai.utils.transport#

The Transport Class defines a transport as used by the Channel class to communicate with the network.

Module Contents#

relevanceai.utils.transport.DO_NOT_REPEAT_STATUS_CODES#
relevanceai.utils.transport.DASHBOARD_MAPPINGS#
class relevanceai.utils.transport.Transport(request_log_filename='request.jsonl', **kwargs)#

_Base class for all relevanceai objects

project :str#
api_key :str#
config :relevanceai.constants.config.Config#
logger :relevanceai.utils.logger.AbstractLogger#
request_logger :relevanceai.utils.logger.FileLogger#
log_response_to_file(self, response, *args, **kwargs)#

It takes the response from the request and logs the url, path_url, method, status_code, headers, content, time, and elapsed time

Parameters

response – The response object

property auth_header(self)#
property DASHBOARD_TYPES(self)#
print_dashboard_message(self, message: str)#
print_dashboard_url(self, dashboard_url)#
make_http_request(self, endpoint: str, method: str = 'GET', parameters: Optional[dict] = None, base_url: str = None, output_format=None, raise_error: bool = True)#

Make the HTTP request :param endpoint: The endpoint from the documentation to use :type endpoint: string :param method_type: POST or GET request :type method_type: string :param raise_error: If True, you will raise error. This is useful for endpoints that don’t

necessarily need to error.

async make_async_http_request(self, endpoint: str, method: str = 'GET', parameters: Optional[dict] = None, base_url: str = None, output_format=None, raise_error: bool = True)#

Make an asynchronous HTTP request

Parameters
  • endpoint (str) – The Relevance AI endpoint to access

  • method_type (str) – Currently only support GET and POST requests

  • raise_error (bool) – If True, error is raised rather than just logged.