mythx_cli package

mythx_cli.cli

The main runtime of the MythX CLI.

class mythx_cli.cli.APIErrorCatcherGroup(name=None, commands=None, **attrs)[source]

Bases: click.core.Group

A custom click group to catch API-related errors.

This custom Group implementation catches MythXAPIError exceptions, which get raised when the API returns a non-200 status code. It is used to notify the user about the error that happened instead of triggering an uncaught exception traceback.

It is given to the main CLI entrypoint and propagated to all subcommands.

mythx_cli.util

mythx_cli.util.write_or_print(ctx, data: str, mode='a+') → None[source]

Depending on the context, write the given content to stdout or a given file.

Parameters:
  • ctx – Click context holding group-level parameters
  • data – The data to print or write to a file
  • mode – The mode to open the file in (if file output enabled)
Returns: