Skip to main content

prs lib

Project description

PRS Lib

是对 PRS REST API 的封装,开发者可以直接调用与 PRS 服务进行通信。

PRS 目前提供了两个环境供开发者使用:

目前对 DApp 开放的接口有:

  • DApp 创建和维护。
  • 用户授权。
  • 签名。
  • 签名文件相关。(签名文件、获取文件)
  • 合约相关。(创建合约、绑定合约、查询合约)
  • 合约交易相关。(购买合约、合约交易记录)
  • 区块信息查询。
  • 钱包相关。(查询钱包、查询交易历史、充值、提现)

快速开始

注册账号

  1. 开发者前往 PRS 官网注册账号。(正式环境:https://press.one 测试环境:https://beta.press.one )
  2. 登录成功后进入开发者设置我的 DApp,完善开发者信息以及创建 DApp。
  3. 在项目中安装此 Lib
  4. DApp 在合适的时候引导用户进行授权
  5. 授权成功后即可进行签名发布文件、创建合约等操作

更多信息,请参考开发者网站

Python 版本支持

支持 >= Python 3.6

安装

通过 pip 安装:

pip install prs-lib

初始化

在代码中 import prs_lib,之后创建 client

import prs_lib


# 初始化 client
client = prs_lib.PRS({
  'env': 'dev',
  'private_key': 'private key ..',
  'address': 'address ...',
  'token': 'token ...',
  'debug': True,
})

# 其中,`env` 是必填的,其它都是可选的

示例代码

以下代码根据块的 id 从链上对块内容进行获取

import prs_lib


client = prs_lib.PRS({
  'env': 'dev',
  'debug': True,
})
res = client.block.get_by_rids([
    'ba03bd584d69b89615ce8db22b4c593342a5ec09b343a7859044a8e4d389c4c2',
    '65163724a98d29506b1031dc68fa62fb5a7a11fe631fb723a723b2a19e9bb65c'
])
print(res.json())

API

prs-lib 暴露一个 PRS 类,开发者通过创建 PRS 实例,来对 REST API 进行交互。

$ pydoc prs_lib

看某个具体模块的帮助,比如,查看 block 的文档:

$ pydoc prs_lib.block

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prs-lib-0.0.4.tar.gz (24.5 kB view details)

Uploaded Source

Built Distribution

prs_lib-0.0.4-py2.py3-none-any.whl (16.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file prs-lib-0.0.4.tar.gz.

File metadata

  • Download URL: prs-lib-0.0.4.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.32.1 CPython/3.7.1

File hashes

Hashes for prs-lib-0.0.4.tar.gz
Algorithm Hash digest
SHA256 4cdef1b2454cf3af9b57a12ced63dd141306d354eff1e077e6b15ad61014c254
MD5 cfc33ac7819b1e861a8bbeaa8ce9191a
BLAKE2b-256 c592c18cc49e870657f3879131310d5891a51a180b6252cd828d6b92c2c60e1c

See more details on using hashes here.

File details

Details for the file prs_lib-0.0.4-py2.py3-none-any.whl.

File metadata

  • Download URL: prs_lib-0.0.4-py2.py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.32.1 CPython/3.7.1

File hashes

Hashes for prs_lib-0.0.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6277e28595471e45c41294644002828a9bb33ab4de104f0d8020a84525fa9488
MD5 73cb594b7f85d0efe11e40b2adeb6985
BLAKE2b-256 333e105edf54afc87f266f89d3d166917c35548c5bc895239542f0562d811e3c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page