update example script

This commit is contained in:
Jack Robison 2017-02-09 10:44:29 -05:00 committed by GitHub
parent 6b22debb79
commit cea4eca775

View file

@ -40,18 +40,28 @@ know all of the necessary chunks.
The bundled LBRY application uses the lbrynet JSONRPC api found in `lbrynet.lbrynet_daemon.LBRYDaemon`. This api allows for applications and web services like the lbry browser UI to interact with lbrynet. If you've installed lbrynet, you can run `lbrynet-daemon` without running the app. While the app or `lbrynet-daemon` is running, you can use the following to show the help for all the available commands: The bundled LBRY application uses the lbrynet JSONRPC api found in `lbrynet.lbrynet_daemon.LBRYDaemon`. This api allows for applications and web services like the lbry browser UI to interact with lbrynet. If you've installed lbrynet, you can run `lbrynet-daemon` without running the app. While the app or `lbrynet-daemon` is running, you can use the following to show the help for all the available commands:
``` ```
from jsonrpc.proxy import JSONRPCProxy import sys
try: try:
from lbrynet.conf import API_CONNECTION_STRING from lbrynet import conf
from lbrynet.lbrynet_daemon.auth.client import LBRYAPIClient
except ImportError:
print "You don't have lbrynet installed!"
sys.exit(0)
conf.initialize_settings()
api = LBRYAPIClient.get_client()
try:
status = api.status()
except: except:
print "You don't have lbrynet installed!" print "lbrynet-daemon isn't running!"
API_CONNECTION_STRING = "http://localhost:5279/lbryapi" sys.exit(0)
api = JSONRPCProxy.from_url(API_CONNECTION_STRING)
status = api.status()
if not status['is_running']: if not status['is_running']:
print status print "lbrynet-daemon hasn't finished starting up, here's the status message:"
print status
sys.exit(0)
else: else:
for cmd in api.commands(): for cmd in api.commands():
print "%s:\n%s" % (cmd, api.help({'command': cmd})) print "%s:\n%s" % (cmd, api.help({'command': cmd}))