parameters: (config)
docstring: Connect to a Ulord Core JSON-RPC server
docstring_summary: Connect to a Ulord Core JSON-RPC server
docstring_tokens: Connect to a Ulord Core JSON - RPC server
function: def connect_JSON(config):
      """Connect to a Ulord Core JSON-RPC server"""
      testnet = config.get('testnet', '0')
      testnet = (int(testnet) > 0)  # 0/1 in config file, convert to True/False
      if not 'rpcport' in config:
          config['rpcport'] = 19998 if testnet else 9998
      connect = "http://%s:%s@127.0.0.1:%s"%(config['rpcuser'], config['rpcpassword'], config['rpcport'])
      try:
          result = ServiceProxy(connect)
          # ServiceProxy is lazy-connect, so send an RPC command mostly to catch connection errors,
          # but also make sure the ulordd we're talking to is/isn't testnet:
          if result.getmininginfo()['testnet'] != testnet:
              sys.stderr.write("RPC server at "+connect+" testnet setting mismatch\n")
              sys.exit(1)
          return result
      except:
          sys.stderr.write("Error connecting to RPC server at "+connect+"\n")
          sys.exit(1)
function_tokens: def connect_JSON ( config ) : testnet = config . get ( 'testnet' , '0' ) testnet = ( int ( testnet ) > 0 ) # 0/1 in config file, convert to True/False if not 'rpcport' in config : config [ 'rpcport' ] = 19998 if testnet else 9998 connect = "http://%s:%s@127.0.0.1:%s" % ( config [ 'rpcuser' ] , config [ 'rpcpassword' ] , config [ 'rpcport' ] ) try : result = ServiceProxy ( connect ) # ServiceProxy is lazy-connect, so send an RPC command mostly to catch connection errors, # but also make sure the ulordd we're talking to is/isn't testnet: if result . getmininginfo ( ) [ 'testnet' ] != testnet : sys . stderr . write ( "RPC server at " + connect + " testnet setting mismatch\n" ) sys . exit ( 1 ) return result except : sys . stderr . write ( "Error connecting to RPC server at " + connect + "\n" ) sys . exit ( 1 )