class LongpollThread(threading.Thread): def __init__(self, node): threading.Thread.__init__(self) # query current longpollid templat = node.getblocktemplate() self.longpollid = templat['longpollid'] # create a new connection to the node, we can't use the same # connection from two threads self.node = AuthServiceProxy(node.url, timeout=600) def run(self): self.node.getblocktemplate({'longpollid':self.longpollid})