用于lbryd和lbrycrd网络的绑定python api
pybr的Python项目详细描述
pybry,用于lbry&lbrycrd的python api包装器
pybry是lbry daemon和 lbrycrd daemonpython 3.x的api
(不久将添加python 2支持)
安装
pip
只需运行以下命令
$ pip install pybry
你完了!
手动克隆存储库
您可以克隆此存储库,也可以从pypi的 你想要什么版本的网站。只需下载并
# Simply clone the repository somewhere $ git clone https://github.com/osilkin98/pybry # Or obtain a release from PyPI's site. $ wget <extremely long link generated by PyPI> $ tar -xzf pybry-x.x.x.tar.gz PyBRY/ # Change directories into the newly created repository $ cd PyBRY/ # Now you simply run the setup.py file: $ python3 setup.py build_py install
用法
使用api
请确保
lbry-daemon
已启动并正在运行,因为您将无法 没有它做任何事。首先,将
LbrydApi
或LbrycrdApi
从pybry
导入到项目中。
lbryd
的api使用生成的代码
api从lbryd
文档生成所有函数,并转换
它变成了有形的、文档化的代码。
[1]frompybryimportLbrydApi# Initialize the API[2]lbry=LbrydApi()# Just call the method as documented in the LBRYD API[3]response=lbry.claim_list(name="bellflower")
因为所有的代码都有适当的文档记录,如果您要求在IDE中提供文档记录, 或者如果你自己去读,它会显示如下:
[4]response=lbry.account_balance()ReturnthebalanceofanaccountParams:account_id–Ifprovidedonlythebalanceforthisaccountwillbegiven(Optional)address–Ifprovidedonlythebalanceforthisaddresswillbegiven(Optional)include_unconfirmed–Includeunconfirmed(Optional)Returns:(decimal)amountoflbrycreditsinwallet(decimal)amountoflbrycreditsinwallet
手动调用api
因为所有代码都是向lbry守护进程发出请求,所以您还可以 就像你在命令线上用卷发一样。事实上,这是 实际上,生成代码的主体是做什么的。
# You can also use the traditional method of making requests # if you prefer the cURL commandline syntax, works the same.response=lbry.call("claim_list",{"name":"bellflower"})
lbrycrd
的apifrompybryimportLbrycrdApi# Provide the username and passwordlbrycrd=LbrycrdApi("username","password")# Just specify the method and the parametersresponse=lbrycrd.call("wallet_unlock",{"wallet_username","wallet_password"})