Add rpc timeout proxy args

This commit is contained in:
lash 2022-05-12 06:26:34 +00:00
parent 2ad84fc5aa
commit 272bf43ba5
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
5 changed files with 8 additions and 31 deletions

View File

@ -11,6 +11,7 @@ import sys
from aiee.arg import (
ArgFlag as BaseArgFlag,
Arg as BaseArg,
process_args,
)
logg = logging.getLogger(__name__)
@ -98,6 +99,8 @@ class Arg(BaseArg):
self.add('p', 'provider', help='RPC HTTP(S) provider url')
self.set_long('p', 'provider')
self.add_long('rpc-dialect', 'provider', help='RPC HTTP(S) backend dialect')
self.add_long('rpc-timeout', 'provider', help='RPC autentication credential values')
self.add_long('rpc-proxy', 'provider', help='RPC autentication credential values')
self.add_long('height', 'no_target', default='latest', help='Block height to execute against')

View File

@ -115,8 +115,8 @@ def process_config(config, arg, args, flags):
config.add(True, '_WAIT')
elif args.w:
config.add(True, '_WAIT')
if arg.match('seq', flags):
if arg.match('seq', flags):
config.add(getattr(args, 'seq'), '_SEQ')
if arg.match('wallet', flags):

View File

@ -61,7 +61,7 @@ class Rpc:
self.id_generator = IntSequenceGenerator()
self.chain_spec = config.get('CHAIN_SPEC')
self.conn = self.constructor(url=config.get('RPC_PROVIDER'), chain_spec=self.chain_spec, auth=auth, verify_identity=config.true('RPC_VERIFY'))
self.conn = self.constructor(url=config.get('RPC_PROVIDER'), chain_spec=self.chain_spec, auth=auth, verify_identity=config.true('RPC_VERIFY'), timeout=float(config.get('RPC_TIMEOUT')))
return self.conn

View File

@ -5,6 +5,8 @@ credentials =
dialect = default
scheme = http
verify = 1
timeout = 10.0
proxy =
[chain]
spec =

View File

@ -122,34 +122,6 @@ class TestCli(unittest.TestCase):
config = Config()
config = process_config(config, self.arg, args, flags)
print(config)
# def test_args_process_extra(self):
# ap = ArgumentParser()
# flags = self.flags.VERBOSE | self.flags.CONFIG
# process_args(ap, self.arg, flags)
# ap.add_argument('--foo', type=str)
# argv = [
# '--foo',
# 'bar',
# ]
# args = ap.parse_args(argv)
# extra_args = {
# 'foo': None,
# }
#
# config = Config()
# config = process_config(config, self.arg, args, flags)
# self.assertEqual(config.get('_FOO'), 'bar')
#
# extra_args = {
# 'foo': 'FOOFOO',
# }
#
# config = Config()
# config = process_config(config, self.arg, args, flags)
# self.assertEqual(config.get('FOOFOO'), 'bar')
if __name__ == '__main__':