edq.net.cli
1import argparse 2import typing 3 4import edq.net.exchange 5import edq.net.request 6import edq.net.settings 7 8def set_cli_args(parser: argparse.ArgumentParser, extra_state: typing.Dict[str, typing.Any]) -> None: 9 """ 10 Set common CLI arguments. 11 This is a sibling to init_from_args(), as the arguments set here can be interpreted there. 12 """ 13 14 group = parser.add_argument_group('network options') 15 16 group.add_argument('--http-exchanges-out-dir', dest = 'http_exchanges_out_dir', 17 action = 'store', type = str, default = None, 18 help = 'If set, write all outgoing HTTP requests as exchanges to this directory.') 19 20 group.add_argument('--https-no-verify', dest = 'https_no_verify', 21 action = 'store_true', default = False, 22 help = 'If set, skip HTTPS/SSL verification.') 23 24def init_from_args( 25 parser: argparse.ArgumentParser, 26 args: argparse.Namespace, 27 extra_state: typing.Dict[str, typing.Any]) -> None: 28 """ 29 Take in args from a parser that was passed to set_cli_args(), 30 and call init() with the appropriate arguments. 31 """ 32 33 if (args.http_exchanges_out_dir is not None): 34 edq.net.settings.set_exchanges_out_dir(args.http_exchanges_out_dir) 35 36 if (args.https_no_verify): 37 edq.net.settings.set_https_verification(False)
def
set_cli_args(parser: argparse.ArgumentParser, extra_state: Dict[str, Any]) -> None:
9def set_cli_args(parser: argparse.ArgumentParser, extra_state: typing.Dict[str, typing.Any]) -> None: 10 """ 11 Set common CLI arguments. 12 This is a sibling to init_from_args(), as the arguments set here can be interpreted there. 13 """ 14 15 group = parser.add_argument_group('network options') 16 17 group.add_argument('--http-exchanges-out-dir', dest = 'http_exchanges_out_dir', 18 action = 'store', type = str, default = None, 19 help = 'If set, write all outgoing HTTP requests as exchanges to this directory.') 20 21 group.add_argument('--https-no-verify', dest = 'https_no_verify', 22 action = 'store_true', default = False, 23 help = 'If set, skip HTTPS/SSL verification.')
Set common CLI arguments. This is a sibling to init_from_args(), as the arguments set here can be interpreted there.
def
init_from_args( parser: argparse.ArgumentParser, args: argparse.Namespace, extra_state: Dict[str, Any]) -> None:
25def init_from_args( 26 parser: argparse.ArgumentParser, 27 args: argparse.Namespace, 28 extra_state: typing.Dict[str, typing.Any]) -> None: 29 """ 30 Take in args from a parser that was passed to set_cli_args(), 31 and call init() with the appropriate arguments. 32 """ 33 34 if (args.http_exchanges_out_dir is not None): 35 edq.net.settings.set_exchanges_out_dir(args.http_exchanges_out_dir) 36 37 if (args.https_no_verify): 38 edq.net.settings.set_https_verification(False)
Take in args from a parser that was passed to set_cli_args(), and call init() with the appropriate arguments.