Skip to main content

Python library for BandChain

Project description

PyBand

BandChain Python Library

⭐️ Features

This helper library allows users to request the latest request result that match scertain input parameters. The parameters that can be specified are:

  • The oracleScriptID
  • the askCount and minCount
  • the calldata (request parameters) associated with the request

For more information on each these, please refer to our wiki.

📦 Installation

The library is available on PyPI

pip install pyband

💎 Example Usage

The example code below shows how the library can be used to get the result of the latest request for the price of Bitcoin. The specified parameters are

  • oracleScriptID: 1
  • calldata: The hex string representing OBI-encoded value of {symbol:BTC,multiplier:1000000}
  • minCount: 4
  • askCount: 4
from pyband import Client, PyObi


def main():
    c = Client("http://guanyu-devnet.bandchain.org/rest")
    req_info = c.get_latest_request(1, bytes.fromhex("0000000342544300000000000f4240"), 4, 4)
    oracle_script = c.get_oracle_script(1)
    obi = PyObi(oracle_script.schema)
    print(obi.decode_output(req_info.result.ResponsePacketData.result))


if __name__ == "__main__":
    main()

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

pyband2-0.0.2.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyband2-0.0.2-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file pyband2-0.0.2.tar.gz.

File metadata

  • Download URL: pyband2-0.0.2.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.9.0

File hashes

Hashes for pyband2-0.0.2.tar.gz
Algorithm Hash digest
SHA256 d52dfa284f929b7e78b021b76d7cc68af7767dff43c234117d7e83cf215ccb19
MD5 8417f9682de680bd60c9650c5fe6ee8e
BLAKE2b-256 24809e7922513ed35db4b0d101561fc0edec0ac6908cf8bead025ccabee03a4b

See more details on using hashes here.

File details

Details for the file pyband2-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: pyband2-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.9.0

File hashes

Hashes for pyband2-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 19f68ef15342b477d16eb436ff9e06af11725017e7a71e4ba3bc367849ee705b
MD5 1a36b1f6a83e1e147c789b2f97e9537d
BLAKE2b-256 2344a2a1ba79e1eef770c8b11408b52bd6d459943c2a0b0bd3a85f899ea179b5

See more details on using hashes here.

Supported by

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