mythx_cli package¶
Subpackages¶
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.
update_context
(context: dict, context_key: str, config: dict, config_key: str, default: Any = None)[source]¶ Update the click context based on a configuration dict.
If the specified key is set in the configuration dict, it will be added/overwrite the respective other key in the click context.
Parameters: - context – The click context dict to set/overwrite
- context_key – The key in the click context to overwrite
- config – The config to read additional data from
- config_key – The config key to overwrite with
- default – The default value to use if all lookups fail
-
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: