def index(self): rpc_uri = os.environ.get('LND_RPC_URI', '127.0.0.1:10009') peer_uri = os.environ.get('LND_PEER_URI', '127.0.0.1:9735') ln = LightningClient(rpc_uri=rpc_uri, peer_uri=peer_uri) try: lnd_info = ln.get_info() lnd_info = MessageToDict(lnd_info) except Exception as exc: lnd_info = {'Error': ' '.join([str(type(exc)), str(exc)])} try: peers = ln.get_peers() peers = MessageToDict(peers)['peers'] if not peers: peers = {'No peers': ' '} except Exception as exc: peers = {'Error': ' '.join([str(type(exc)), str(exc)])} try: channels = ln.get_channels() channels = MessageToDict(channels)['channels'] if not channels: channels = {'No channels': ' '} except Exception as exc: channels = {'Error': ' '.join([str(type(exc)), str(exc)])} return self.render('admin/lnd_dashboard.html', lnd_info=lnd_info, peers=peers, channels=channels)
def index(self): ln = LightningClient(rpc_uri=LND_RPC_URI, peer_uri=LND_PEER_URI) lnd_info = ln.get_info() if lnd_info is False: lnd_info = {} else: lnd_info = MessageToDict(lnd_info) peers = ln.get_peers() if not peers: peers = {'No peers': ' '} else: peers = [MessageToDict(p) for p in peers] channels = ln.get_channels() if not channels: channels = {'No channels': ' '} else: channels = [MessageToDict(c) for c in channels] return self.render('admin/lnd/lnd_dashboard.html', lnd_info=lnd_info, peers=peers, channels=channels)