def get_peers(): # 1. start interface and wait for connection q = Queue.Queue() interface = electrum.Interface( 'urhypcy52ob5wkuqocfafxkxsawceiprwztvhxkksei665moxuea.b32.i2p:50001:s', q) interface.start() i, r = q.get() if not interface.is_connected(): raise BaseException("not connected") # 2. get list of peers interface.send_request({ 'id': 0, 'method': 'server.peers.subscribe', 'params': [] }) i, r = q.get(timeout=10000) peers = parse_servers(r.get('result')) peers = filter_protocol(peers, 's') i.stop() return peers