Add rpc timeout proxy args
This commit is contained in:
parent
2ad84fc5aa
commit
272bf43ba5
@ -11,6 +11,7 @@ import sys
|
|||||||
from aiee.arg import (
|
from aiee.arg import (
|
||||||
ArgFlag as BaseArgFlag,
|
ArgFlag as BaseArgFlag,
|
||||||
Arg as BaseArg,
|
Arg as BaseArg,
|
||||||
|
process_args,
|
||||||
)
|
)
|
||||||
|
|
||||||
logg = logging.getLogger(__name__)
|
logg = logging.getLogger(__name__)
|
||||||
@ -98,6 +99,8 @@ class Arg(BaseArg):
|
|||||||
self.add('p', 'provider', help='RPC HTTP(S) provider url')
|
self.add('p', 'provider', help='RPC HTTP(S) provider url')
|
||||||
self.set_long('p', 'provider')
|
self.set_long('p', 'provider')
|
||||||
self.add_long('rpc-dialect', 'provider', help='RPC HTTP(S) backend dialect')
|
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')
|
self.add_long('height', 'no_target', default='latest', help='Block height to execute against')
|
||||||
|
|
||||||
|
@ -115,8 +115,8 @@ def process_config(config, arg, args, flags):
|
|||||||
config.add(True, '_WAIT')
|
config.add(True, '_WAIT')
|
||||||
elif args.w:
|
elif args.w:
|
||||||
config.add(True, '_WAIT')
|
config.add(True, '_WAIT')
|
||||||
|
|
||||||
if arg.match('seq', flags):
|
if arg.match('seq', flags):
|
||||||
config.add(getattr(args, 'seq'), '_SEQ')
|
config.add(getattr(args, 'seq'), '_SEQ')
|
||||||
|
|
||||||
if arg.match('wallet', flags):
|
if arg.match('wallet', flags):
|
||||||
|
@ -61,7 +61,7 @@ class Rpc:
|
|||||||
self.id_generator = IntSequenceGenerator()
|
self.id_generator = IntSequenceGenerator()
|
||||||
|
|
||||||
self.chain_spec = config.get('CHAIN_SPEC')
|
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
|
return self.conn
|
||||||
|
|
||||||
|
@ -5,6 +5,8 @@ credentials =
|
|||||||
dialect = default
|
dialect = default
|
||||||
scheme = http
|
scheme = http
|
||||||
verify = 1
|
verify = 1
|
||||||
|
timeout = 10.0
|
||||||
|
proxy =
|
||||||
|
|
||||||
[chain]
|
[chain]
|
||||||
spec =
|
spec =
|
||||||
|
@ -122,34 +122,6 @@ class TestCli(unittest.TestCase):
|
|||||||
|
|
||||||
config = Config()
|
config = Config()
|
||||||
config = process_config(config, self.arg, args, flags)
|
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__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
Reference in New Issue
Block a user