original_docstring: Send the RPC command to the server and print the result.
docstring: Send the RPC command to the server and print the result.
docstring_tokens: Send the RPC command to the server and print the result .
code: def main():
      '''Send the RPC command to the server and print the result.'''
      parser = argparse.ArgumentParser('Send electrumx an RPC command' )
      parser.add_argument('-p', '--port', metavar='port_num', type=int,
                          help='RPC port number')
      parser.add_argument('command', nargs=1, default=[],
                          help='command to send')
      parser.add_argument('param', nargs='*', default=[],
                          help='params to send')
      args = parser.parse_args()
  
      if args.port is None:
          args.port = int(environ.get('RPC_PORT', 8000))
  
      loop = asyncio.get_event_loop()
      coro = loop.create_connection(RPCClient, 'localhost', args.port)
      try:
          transport, protocol = loop.run_until_complete(coro)
          coro = protocol.send_and_wait(args.command[0], args.param, timeout=15)
          loop.run_until_complete(coro)
      except OSError:
          print('error connecting - is ElectrumX catching up or not running?')
      finally:
          loop.close()
code_tokens: def main ( ) : parser = argparse . ArgumentParser ( 'Send electrumx an RPC command' ) parser . add_argument ( '-p' , '--port' , metavar = 'port_num' , type = int , help = 'RPC port number' ) parser . add_argument ( 'command' , nargs = 1 , default = [ ] , help = 'command to send' ) parser . add_argument ( 'param' , nargs = '*' , default = [ ] , help = 'params to send' ) args = parser . parse_args ( ) if args . port is None : args . port = int ( environ . get ( 'RPC_PORT' , 8000 ) ) loop = asyncio . get_event_loop ( ) coro = loop . create_connection ( RPCClient , 'localhost' , args . port ) try : transport , protocol = loop . run_until_complete ( coro ) coro = protocol . send_and_wait ( args . command [ 0 ] , args . param , timeout = 15 ) loop . run_until_complete ( coro ) except OSError : print ( 'error connecting - is ElectrumX catching up or not running?' ) finally : loop . close ( )
short_docstring: Send the RPC command to the server and print the result.
short_docstring_tokens: Send the RPC command to the server and print the result .
comment: '''Send the RPC command to the server and print the result.'''