Android, Remote Only Client
Re: Android, Remote Only Client
Ah sorry, I gave you the wrong method, it's auth.login, must've been having a sleepy moment. Apologies.
-
- Member
- Posts: 25
- Joined: Tue May 12, 2009 5:27 pm
Re: Android, Remote Only Client
Okay, so I am using 'auth.login' now, which returns:
And indeed it also returns a header row for the cookie:
EDIT: What cookie specification did you use? My HttpClient (Apache Commons) gives a parse error:
I think their should be - signs between 02-Sep-2009?
Code: Select all
{"id": 1, "result": true, "error": null}
Code: Select all
Transfer-Encoding: chunked,
Date: Wed, 02 Sep 2009 12:02:59 GMT,
Content-Type: application/x-json,
Server: TwistedWeb/8.2.0,
Set-Cookie: _session_id=ccc63c79be099e69279f3418fe9f6bc52324; Expires=Wed, 02 Sep 2009 13:02:59 UTC; Path=/json
Code: Select all
Invalid cookie header: "Set-Cookie: _session_id=7f85f51a950d854df35fd07a620dd0d62248; Expires=Wed, 02 Sep 2009 13:42:13 UTC; Path=/json". Unable to parse expires attribute: Wed, 02 Sep 2009 13:42:13 UTC
Re: Android, Remote Only Client
According to:
http://www.w3.org/Protocols/rfc2616/rfc ... tml#sec3.3
It should be absolutely fine. Only thing I can think of is that it isn't liking the UTC timezone, would you mind trying to change it to GMT to see if that solves the situation?
The dates are formed on lines 128 and 227 in deluge/ui/web/auth.py.
http://www.w3.org/Protocols/rfc2616/rfc ... tml#sec3.3
It should be absolutely fine. Only thing I can think of is that it isn't liking the UTC timezone, would you mind trying to change it to GMT to see if that solves the situation?
The dates are formed on lines 128 and 227 in deluge/ui/web/auth.py.
-
- Member
- Posts: 25
- Joined: Tue May 12, 2009 5:27 pm
Re: Android, Remote Only Client
Jup, that worked! I replaced the hard-coded 'UTC' text with 'GMT'. (In my SVN version of auth.py, it was only in line 128.)
I now get a cookie:
Which the Apache HttpClient parses just fine. And indeed I get authenticated correctly by Deluge, returning the torrent listing again.
I now get a cookie:
Code: Select all
Set-Cookie: _session_id=ee26b4ae24a71aae5935a47f3ba80f222324; Expires=Thu, 03 Sep 2009 10:08:24 GMT; Path=/json
Re: Android, Remote Only Client
Brilliant, well just commited a fix changing this for everyone now!
-
- Member
- Posts: 25
- Joined: Tue May 12, 2009 5:27 pm
Re: Android, Remote Only Client
So, it seems I have another issue with my Deluge support. I'm not sure if you've noticed at all, but removing of torrents doesn't work any more.
Actually, when I try to remove a torrent, it sends this RPC command:
The Deluge server now doesn't respond, but an error message is show on the command line output:
Since the torrents are retrieved from the server with exactly that ID, I am sure that it exists. It seems I do not have control over it from this session or something. The source code or torrentmanager.py also didn't give me any hints. Any ideas?
Actually, when I try to remove a torrent, it sends this RPC command:
Code: Select all
{"method":"core.remove_torrent","params":[["60d5d82328b4547511fdeac9bf4d0112daa0ce00"],false],"id":2}
Code: Select all
[ERROR ] 11:24:11 client:375 RPCError Message Received!
--------------------------------------------------------------------------------
RPCRequest: core.remove_torrent([u'60d5d82328b4547511fdeac9bf4d0112daa0ce00'], False)
--------------------------------------------------------------------------------
File "/usr/local/lib/python2.6/dist-packages/deluge-1.2.0_dev-py2.6.egg/deluge/core/rpcserver.py", line 281, in dispatch
ret = self.factory.methods[method](*args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/deluge-1.2.0_dev-py2.6.egg/deluge/core/core.py", line 288, in remove_torrent
return self.torrentmanager.remove(torrent_id, remove_data)
File "/usr/local/lib/python2.6/dist-packages/deluge-1.2.0_dev-py2.6.egg/deluge/core/torrentmanager.py", line 479, in remove
raise InvalidTorrentError("torrent_id not in session")
InvalidTorrentError: torrent_id not in session
Re: Android, Remote Only Client
Ahh, all the *_torrent functions where changed from accepting a list of ids to just a single id.
We have actually (finally) produced some documentation now: http://deluge-torrent.org/docs/1.2/core ... remote-api
That's only for the core, I still need to have some generating for the additional web api methods.
We have actually (finally) produced some documentation now: http://deluge-torrent.org/docs/1.2/core ... remote-api
That's only for the core, I still need to have some generating for the additional web api methods.
-
- Member
- Posts: 25
- Joined: Tue May 12, 2009 5:27 pm
Re: Android, Remote Only Client
Thanks for that reply. I changed the method call and it works again.
-
- Member
- Posts: 25
- Joined: Tue May 12, 2009 5:27 pm
Re: Android, Remote Only Client
Back again with another question! 
I am implementing support in my Android app to allow user to set the maximum transfer rates (download and upload). Here is the JSON request I am sending to Deluge:
But then Deluge spits out an error to my console:
Probably I should send the JSON data in some different format, but I'm not sure how. (I tried several options myself.) Can you provide me an example JSON request string for the set_config method?

I am implementing support in my Android app to allow user to set the maximum transfer rates (download and upload). Here is the JSON request I am sending to Deluge:
Code: Select all
{"id":2,"method":"core.set_config","params":[[{"max_upload_speed":2},{"max_download_speed":1}]]}
Code: Select all
[ERROR ] 10:29:02 client:375 RPCError Message Received!
--------------------------------------------------------------------------------
RPCRequest: core.set_config([{u'max_upload_speed': 2}, {u'max_download_speed': 1}])
--------------------------------------------------------------------------------
File "/usr/local/lib/python2.6/dist-packages/deluge-1.3.0_dev-py2.6.egg/deluge/core/rpcserver.py", line 281, in dispatch
ret = self.factory.methods[method](*args, **kwargs)
File "/usr/local/lib/python2.6/dist-packages/deluge-1.3.0_dev-py2.6.egg/deluge/core/core.py", line 478, in set_config
for key in config.keys():
AttributeError: 'tuple' object has no attribute 'keys'
Re: Android, Remote Only Client
You've got one too many [] around the params, should be params: [{.....}], not params: [[{....}]]ElmoTheElk wrote:Back again with another question!
I am implementing support in my Android app to allow user to set the maximum transfer rates (download and upload). Here is the JSON request I am sending to Deluge:But then Deluge spits out an error to my console:Code: Select all
{"id":2,"method":"core.set_config","params":[[{"max_upload_speed":2},{"max_download_speed":1}]]}
Probably I should send the JSON data in some different format, but I'm not sure how. (I tried several options myself.) Can you provide me an example JSON request string for the set_config method?Code: Select all
[ERROR ] 10:29:02 client:375 RPCError Message Received! -------------------------------------------------------------------------------- RPCRequest: core.set_config([{u'max_upload_speed': 2}, {u'max_download_speed': 1}]) -------------------------------------------------------------------------------- File "/usr/local/lib/python2.6/dist-packages/deluge-1.3.0_dev-py2.6.egg/deluge/core/rpcserver.py", line 281, in dispatch ret = self.factory.methods[method](*args, **kwargs) File "/usr/local/lib/python2.6/dist-packages/deluge-1.3.0_dev-py2.6.egg/deluge/core/core.py", line 478, in set_config for key in config.keys(): AttributeError: 'tuple' object has no attribute 'keys'
