jina.clients.helper module#

Helper functions for clients in Jina.

jina.clients.helper.pprint_routes(resp, stack_limit=3)[source]#

Pretty print routes with prettytable, fallback to print().

Parameters
  • resp (Response) – the Response object

  • stack_limit (int) – traceback limit

jina.clients.helper.callback_exec(response, on_done, on_error, on_always, continue_on_error, logger)[source]#

Execute the callback with the response.

Parameters
  • response – the response

  • on_done (Callable) – the on_done callback

  • on_error (Callable) – the on_error callback

  • on_always (Callable) – the on_always callback

  • continue_on_error (bool) – whether to continue on error

  • logger (JinaLogger) – a logger instance

Return type

None

jina.clients.helper.callback_exec_on_error(on_error, exception, logger, response=None)[source]#

Execute the on_error callback with the response, Use when an error outside the response status was thrown. :param on_error: the on_error callback :param exception: the exception with was thrown and led to the call of on_error :param logger: a logger instance :param response: the response