[JSON API] Check Connection

General support for problems installing or using Deluge
Post Reply
gprime
New User
New User
Posts: 7
Joined: Thu Apr 19, 2012 7:28 pm

[JSON API] Check Connection

Post 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.
Cas
Top Bloke
Top Bloke
Posts: 3681
Joined: Mon Dec 07, 2009 6:04 am
Location: Scotland

Re: Check Connection

Post 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
gprime
New User
New User
Posts: 7
Joined: Thu Apr 19, 2012 7:28 pm

Re: Check Connection

Post by gprime »

Awesome, thanks!

Works great
Post Reply