small fixes

This commit is contained in:
Alex Grintsvayg 2017-03-16 15:35:54 -04:00
parent 52d471d660
commit bfd822782d
3 changed files with 12 additions and 10 deletions

View file

@ -19,8 +19,8 @@ at anytime.
* *
### Fixed ### Fixed
* * Fixed jsonrpc_reflect()
* * Fixed api help return
* *
## [0.9.1rc2] - 2017-03-15 ## [0.9.1rc2] - 2017-03-15

View file

@ -7,6 +7,7 @@ import base58
import requests import requests
import urllib import urllib
import json import json
import textwrap
from requests import exceptions as requests_exceptions from requests import exceptions as requests_exceptions
import random import random
@ -1352,7 +1353,7 @@ class Daemon(AuthJSONRPCServer):
) )
return self._render_response({ return self._render_response({
'help': fn.__doc__ 'help': textwrap.dedent(fn.__doc__)
}) })
def jsonrpc_commands(self): def jsonrpc_commands(self):
@ -2204,6 +2205,7 @@ class Daemon(AuthJSONRPCServer):
d.addCallback(lambda _: self._render_response("Announced")) d.addCallback(lambda _: self._render_response("Announced"))
return d return d
@defer.inlineCallbacks
def jsonrpc_reflect(self, sd_hash): def jsonrpc_reflect(self, sd_hash):
""" """
Reflect a stream Reflect a stream
@ -2214,12 +2216,11 @@ class Daemon(AuthJSONRPCServer):
(bool) true if successful (bool) true if successful
""" """
d = self._get_lbry_file(FileID.SD_HASH, sd_hash, return_json=False) lbry_file = yield self._get_lbry_file(FileID.SD_HASH, sd_hash, return_json=False)
d.addCallback(self._reflect) if lbry_file is None:
d.addCallbacks( raise Exception('No file found for give sd hash')
lambda _: self._render_response(True), yield reupload.reflect_stream(lbry_file)
lambda err: self._render_response(err.getTraceback())) defer.returnValue("Reflect success")
return d
def jsonrpc_get_blob_hashes(self): def jsonrpc_get_blob_hashes(self):
""" """

View file

@ -64,7 +64,8 @@ def main():
os.path.basename(sys.argv[0])) os.path.basename(sys.argv[0]))
) )
else: else:
print api.call('help', params).strip() help_response = api.call('help', params)
print help_response['help'] if 'help' in help_response else help_response
elif method not in api.commands(): elif method not in api.commands():
print_error("'" + method + "' is not a valid command.") print_error("'" + method + "' is not a valid command.")