gpt4 book ai didi

python - 如何重新启动 twisted 和 deluge 客户端 rpc 的 react 器

转载 作者:行者123 更新时间:2023-11-28 22:53:21 24 4
gpt4 key购买 nike

我在使用扭曲框架时遇到问题,我无法重新启动。我的代码需要连接到某些不同节点中的不同泛滥客户端守护程序。为此,我需要先断开连接,但扭曲不允许我重新连接到另一个客户端。这是我的代码:

    ip = ['localhost', 'debci-lab']
for i in range(len(ip)):
ip_connect = ip[i]
d = client.connect(host=ip_connect)
# We create a callback function to be called upon a successful connection
def on_get_config(result):
print result

def on_connect_success(result):
print "Connection was successful!"
print "result:", result
client.core.get_torrent_status('dd69058c737d914c4e8e985d47a29606de80d34e', ['download_payload_rate']).addCallback(on_get_config)
client.disconnect()
# We add the callback to the Deferred object we got from connect()
d.addCallback(on_connect_success)

# We create another callback function to be called when an error is encountered
def on_connect_fail(result):
print "result:", result

# We add the callback (in this case it's an errback, for error)
d.addErrback(on_connect_fail)

reactor.run()

循环只运行一次,并输出:连接成功!结果:10

但不是预期的下载率。

感谢您的宝贵时间。

最好的问候。

最佳答案

这对我有用 reactor.crash() for loop, reactor.start() do something, stop and repeat 。 . .

def main(myrequest):
print myrequest
data=[]
errors=[]

def got_data(mydata):
data.append(mydata)
process()

def no_data(err):
print >>sys.stderr, 'failed:', err
errors.append(err)
process()

def process():
if errors or data:
reactor.crash()

make_request("localhost", 9000, got_data, no_data, myrequest)

return data

if __name__ == '__main__':
bbg=["DBK GY EQUITY","IBM US Equity"]
flds=["DVD_HIST"]
for b in bbg:
myrequest=bulk(b , flds)
print ">>>>>>>>>>>>>>", main(myrequest)

关于python - 如何重新启动 twisted 和 deluge 客户端 rpc 的 react 器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19528418/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com