Skip to main content

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()

Metadata

Release files for pyband2 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyband2 0.0.2
File Size Uploaded
pyband2-0.0.2.tar.gz 11.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyband2 0.0.2
File Interpreter ABI Platform
pyband2-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 24.6 kB

Release files / pyband2-0.0.2.tar.gz

Download URL pyband2-0.0.2.tar.gz
Size 11.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d52dfa284f929b7e78b021b76d7cc68af7767dff43c234117d7e83cf215ccb19
BLAKE2b-256 checksum
How to use checksums
24809e7922513ed35db4b0d101561fc0edec0ac6908cf8bead025ccabee03a4b
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / pyband2-0.0.2-py3-none-any.whl

Download URL pyband2-0.0.2-py3-none-any.whl
Size 12.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
19f68ef15342b477d16eb436ff9e06af11725017e7a71e4ba3bc367849ee705b
BLAKE2b-256 checksum
How to use checksums
2344a2a1ba79e1eef770c8b11408b52bd6d459943c2a0b0bd3a85f899ea179b5
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page