简体   繁体   English

使用aria2的RPC接口时如何配置超时?

[英]How to config timeout when using the RPC interface of aria2?

I'm using the xmlrpclib of Python to interact with aria2 to manage files to download. 我正在使用Python的xmlrpclibaria2进行交互以管理要下载的文件。

In the documentation , the only option that's shown in example is: dir . 文档中 ,示例中显示的唯一选项是: dir

I can also use out to specify the filename, now I wonder how to config things like -timeout and --connect-timeout . 我还可以用out指定文件名,现在我想知道如何配置-timeout--connect-timeout类的东西。

I've tried timeout and connect_timeout , but that doesn't work. 我已经尝试过timeoutconnect_timeout ,但这不起作用。

You need to set timeout on the socket library level: 您需要在socket库级别设置超时:

import socket
socket.setdefaulttimeout(<your_value>)

This value will be used by xmlrpclib . xmlrpclib将使用此值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM