forked from LBRYCommunity/lbry-sdk
update example script
This commit is contained in:
parent
6b22debb79
commit
cea4eca775
1 changed files with 18 additions and 8 deletions
20
README.md
20
README.md
|
@ -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
|
||||||
except:
|
from lbrynet.lbrynet_daemon.auth.client import LBRYAPIClient
|
||||||
|
except ImportError:
|
||||||
print "You don't have lbrynet installed!"
|
print "You don't have lbrynet installed!"
|
||||||
API_CONNECTION_STRING = "http://localhost:5279/lbryapi"
|
sys.exit(0)
|
||||||
|
|
||||||
api = JSONRPCProxy.from_url(API_CONNECTION_STRING)
|
conf.initialize_settings()
|
||||||
|
api = LBRYAPIClient.get_client()
|
||||||
|
|
||||||
|
try:
|
||||||
status = api.status()
|
status = api.status()
|
||||||
|
except:
|
||||||
|
print "lbrynet-daemon isn't running!"
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
if not status['is_running']:
|
if not status['is_running']:
|
||||||
|
print "lbrynet-daemon hasn't finished starting up, here's the status message:"
|
||||||
print status
|
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}))
|
||||||
|
|
Loading…
Reference in a new issue