I'll preface this with saying I have a lot to learn about using python and JSON API. That being said I was able to cobble together some scripts today that support API calls to both couchpotato and sonarr. But, for the life of me I can't seem to script any proper connections to deluge (1.3.15).

It appears that the docs are in a very disreputable state and I've literally spent 3x as much time on this then the other APIs combined with little to show.At this point I'm simply trying to make a connection to the API and remove a torrent. This is what my test script looks like:

However, if I run the script again - or run it with a torrent_id that is invalid (doesn't exist/already removed/etc). The second post request just seems to hang indefinitely. If I put timeout parameters on the post then it will timeout and kill the script (no error handling yet).

I have no idea what is wrong as the methods and commands, etc that I have in my script are really the result of trial and error looking at dozens of posts here and stack exchange, etc.

I can't believe that the correct behavior is just to hang, but I know my basic syntax is correct since the first run will remove the torrent if there.