Page 1 of 1

[JSON API] Check Connection

Posted: Thu Apr 26, 2012 7:38 pm
by gprime
Is there a way using the json rpc to check if an active connection with my cookie is still set?

For example, I have software that runs each second to get the status of all torrents. Each time I run this script it does a web.connect rpc command. Now this works most of the time but sometimes it just stalls on the web.connect request. Its probably because I am attempting to many connections. But if I authenticated and connected using a cookie in a previous process (and I save the cookie value) can I just use that cookie value and not reconnect?

These are the three calls I do each time i run the script:

auth.login
web.get_hosts
web.connect <-- stalls here after a bunch of requests.

Re: Check Connection

Posted: Thu Apr 26, 2012 9:52 pm
by Cas
can I just use that cookie value and not reconnect?
Yes, from docs:
http://deluge-torrent.org/docs/master/modules/ui/web/auth.html wrote:check_session(session_id=None)
Check a session to see if it’s still valid.
Returns: True if the session is valid, False if not.
Return type: booleon

Re: Check Connection

Posted: Mon Apr 30, 2012 6:12 pm
by gprime
Awesome, thanks!

Works great