用于与开放平台交互的sdk库。

open-api-sdk的Python项目详细描述


打开api sdk

open api-sdk是一个与开放平台交互的库。

内容

安装

使用pip:

$ pip install open-api-sdk

开始

开放平台使用openkeys来允许访问api。您可以在Account.上注册新的openkey

open平台希望openkey包含在对服务器的所有api请求中。

我们假设此时您已经拥有了openkey。

要访问库,请导入一个openplatform类并使用openkey调用一个实例,如下所示:

fromopenp_pyimportOpenPy# Access API via instance of OpenPlatform classop=OpenPy(open_key)

open_key-你的公开密钥。

在下面的示例中,假设op是用open_key

实例化OpenPlatform类的结果。

api

页面请求属性
AttributeTypeDescription
offsetLongPage offset
limitIntPage limit

页面响应属性
AttributeTypeDescription
totalCountLongTotal count of entities in a database
list[]List of entities with type T (T is generic)
脚手架

脚手架属性
AttributeTypeDescription
addressStringScaffold address
abiStringScaffold json interface
descriptionStringScaffold description
fiatAmountStringScaffold fiat amount
currencyStringFiat amount currency
conversionAmountStringFiat amount converted to ethereum
developerAddressStringScaffold developer address
webHookStringScaffold webhook for events
propertiesScaffoldProperty[]Scaffold properties
脚手架属性属性
AttributeTypeDescription
nameStringProperty name
typePropertyTypeProperty type
defaultValueStringProperty default value
全部获取(
scaffolds=op.scaffold.get_all()
获取单个(地址)
address='0x1c297f40beb075936d6dbe4b245b92738867ecb1'# an address of the scaffold (example)scaffold=op.scaffold.get_single(address)
脚手架汇总属性
AttributeTypeDescription
scaffoldScaffoldScaffold
transactionIndexBigIntegerTransaction index
tokenBalanceBigIntegerScaffold token balance
enabledBooleanScaffold enabled
currencyStringFiat amount currency
shareHoldersShareHolderScaffold shareholders
获取摘要(地址)
summary=op.scaffold.get_summary(address)
获取交易(地址)
transactions=op.scaffold.get_summary(address)
设置web hook请求data
AttributeTypeDescription
addressStringScaffold address
webHookStringScaffold webhook for events
示例:
data={'webHook':'https://example.com'}
设置Webhook(地址、数据)
scaffold=op.scaffold.set_webhook(address,data)
部署脚手架请求data
AttributeTypeDescription
openKeyStringUser open key
descriptionStringScaffold description
fiatAmountStringScaffold fiat amount
currencyStringFiat amount currency
conversionAmountStringFiat amount converted to ethereum
developerAddressStringScaffold developer address
webHookStringScaffold webhook for events
propertiesScaffoldProperty[]Scaffold properties
示例:
data={'openKey':open_key,'developerAddress':'0x0000000000000000000000000000000000000000','description':"any_description",'fiatAmount':"123",'currency':"USD",'conversionAmount':'0.2139521163','properties':[{'name':"property_name",'type':"STRING",'defaultValue':"property_value"}]}
部署脚手架(数据)
scaffold=op.scaffold.deploy(data)
停用脚手架(地址)
scaffold=op.scaffold.deactivate(address)
配额属性
AttributeTypeDescription
currentCountIntCurrent deactivated scaffolds count
limitCountIntLimit of deactivated scaffolds count
获取配额()
quota=op.scaffold.get_quota()

股东

股东属性
AttributeTypeDescription
addressStringShareholder address
percentIntShareholder percent
示例:
# Shareholder attributesdata={'address':'0x0000000000000000000000000000000000000000','percent':30}
添加(地址、数据)
summary=op.shareholder.create(address,data)
更新股东请求data
AttributeTypeDescription
percentIntShareholder percent
示例:
data={'percent':50}
更新(地址、持有人地址、数据)
shareholder_address="0xDc29484cc9C02Ee01015f33BcA8bBb5C7293Fb54"# an example of shareholder's addresssummary=op.shareholder.update(address,shareholder_address,data)
删除(地址,持有者地址)
summary=op.shareholder.remove(address,shareholder_address)

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
使用SerializationUtils时java ClassNotFoundException。克隆()   java Cucumber+spring:如何通过测试触发SmartLifecycle事件?   java如何使ProGuard以简单的方式工作?   java JSP页面显示来自集合的日期   谷歌地图检查坐标是否位于JAVA中谷歌地图API的多边形中   java如何在终端中使用“tokens”打印令牌?   java获取编译错误:包com。威里奥。sdk不存在   java会使用JAXB或类似工具自动填充HATEAOS链接吗?   Javascript(GraalJS)与Java中未签名的右移>>>>   如何在Java代码中创建jdbc请求的Jmeter测试   java如何在CellList中添加或删除单个元素?   java Progressbar:如何创建原始对象的深度副本