hntpy


Namehntpy JSON
Version 0.0.9 PyPI version JSON
download
home_pagehttps://github.com/h-morgan/hntpy
SummaryPython wrapper for Helium API to simplify interactions with the Helium blockchain.
upload_time2022-12-03 23:50:05
maintainer
docs_urlNone
authorHaley Morgan
requires_python>=3.7,<4.0
licenseMIT
keywords helium crypto hnt blockchain
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # hntpy

<p align="left">
    <a alt="Version" href="https://pypi.org/project/hntpy/">
    <img src="https://img.shields.io/badge/version-0.0.9-blue"/></a>
    <a href="https://github.com/h-morgan/hntpy/blob/main/LICENSE" alt="License">
    <img src="https://img.shields.io/github/license/h-morgan/hntpy"/></a>
    <a href="#">
    <img src="https://img.shields.io/badge/coverage-99%25-green"/></a>
</p>

## Introduction

hntpy is a Python wrapper for Helium API to simplify requests and interaction with Helium blockchain. The aim of this project is to enable retrieval of Helium data from the API in a Pythonic way.

For comprehensive documentation (with examples), review the full usage [docs](https://github.com/h-morgan/hntpy/tree/main/docs).

For more detail on exact API responses/data, please see the officical [Helium documentation](https://docs.helium.com/api/blockchain/introduction).

This project is continually under development. If you notice a bug, or have a feature request, please submit a Github issue [here](https://github.com/h-morgan/hntpy/issues).

## Install

To use the latest version of this Python package, download from PyPi:

```
pip install hntpy
```

## Example Usage

Below are a couple of examples to show how the `hntpy` package can be used. For comprehensive documentation, including all function definitions, argument examples, and more, view the [full docs](https://github.com/h-morgan/hntpy/tree/main/docs).

```python
from hntpy import Account, Hotspot, Validator

# ===================================

## sample account functionality
account = Account(address="51-character-account-address")

# get validators and hotspots associated with an account
validators = account.validators()
hotspots = account.hotspots()

# get a generator of rewards, in a given time window, for an account (optionally can also return a list)
rewards_generator = account.rewards(min_time="2022-01-01", max_time="2022-06-01", gen=True)

for batch in rewards_generator:
    for reward in batch:
        # do some processing with the reward here...

# ===================================

## sample hotspot functionality

hotspot = Hotspot(address="51-character-hotspot-address")

# get roles (activity) for a hotspot, can optionally provide timeframe and response limit
roles = hotspot.roles(min_time="2022-01-01", limit=100)

# get the total reward sum for the hotspot, optionally in a given timeframe
rewards = hotspot.rewards(min_time="2022-01-01", max_time="2022-06-01")

# get hotspots that the given hotspot witnessed over the last 5 days
witnessed = hotspot.witnessed()

# ===================================

## sample validator functionality

validator = Validator(address="51-character-validator-address")

# get roles (activity) for a hotspot, can optionally provide timeframe and response limit
roles = validator.roles(limit=200)

```

## Return types

The Helium API returns either JSON objects (loaded as `dicts`) of data, or `lists` of data. All of the functions in the `hntpy` package that make requests to the Helium API return either:

- `list`
- `dict`
- `GeneratorType`

For requests that have the potential to return large amounts of data, there is the option to provide a `gen=True` argument to the method, which will yield the data in batches (rather than compile and return one single large list). By default, `gen` parameter is set to `False` for all methods.

To see available return types for specific methods, see method definitions in the respective module's documentation page.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/h-morgan/hntpy",
    "name": "hntpy",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7,<4.0",
    "maintainer_email": "",
    "keywords": "helium,crypto,hnt,blockchain",
    "author": "Haley Morgan",
    "author_email": "haleymorgan3264@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/6e/97/fdd94d341f014e5a1e6b5d8e3d59d20e60690f9fd9c8daa063ee098594b8/hntpy-0.0.9.tar.gz",
    "platform": null,
    "description": "# hntpy\n\n<p align=\"left\">\n    <a alt=\"Version\" href=\"https://pypi.org/project/hntpy/\">\n    <img src=\"https://img.shields.io/badge/version-0.0.9-blue\"/></a>\n    <a href=\"https://github.com/h-morgan/hntpy/blob/main/LICENSE\" alt=\"License\">\n    <img src=\"https://img.shields.io/github/license/h-morgan/hntpy\"/></a>\n    <a href=\"#\">\n    <img src=\"https://img.shields.io/badge/coverage-99%25-green\"/></a>\n</p>\n\n## Introduction\n\nhntpy is a Python wrapper for Helium API to simplify requests and interaction with Helium blockchain. The aim of this project is to enable retrieval of Helium data from the API in a Pythonic way.\n\nFor comprehensive documentation (with examples), review the full usage [docs](https://github.com/h-morgan/hntpy/tree/main/docs).\n\nFor more detail on exact API responses/data, please see the officical [Helium documentation](https://docs.helium.com/api/blockchain/introduction).\n\nThis project is continually under development. If you notice a bug, or have a feature request, please submit a Github issue [here](https://github.com/h-morgan/hntpy/issues).\n\n## Install\n\nTo use the latest version of this Python package, download from PyPi:\n\n```\npip install hntpy\n```\n\n## Example Usage\n\nBelow are a couple of examples to show how the `hntpy` package can be used. For comprehensive documentation, including all function definitions, argument examples, and more, view the [full docs](https://github.com/h-morgan/hntpy/tree/main/docs).\n\n```python\nfrom hntpy import Account, Hotspot, Validator\n\n# ===================================\n\n## sample account functionality\naccount = Account(address=\"51-character-account-address\")\n\n# get validators and hotspots associated with an account\nvalidators = account.validators()\nhotspots = account.hotspots()\n\n# get a generator of rewards, in a given time window, for an account (optionally can also return a list)\nrewards_generator = account.rewards(min_time=\"2022-01-01\", max_time=\"2022-06-01\", gen=True)\n\nfor batch in rewards_generator:\n    for reward in batch:\n        # do some processing with the reward here...\n\n# ===================================\n\n## sample hotspot functionality\n\nhotspot = Hotspot(address=\"51-character-hotspot-address\")\n\n# get roles (activity) for a hotspot, can optionally provide timeframe and response limit\nroles = hotspot.roles(min_time=\"2022-01-01\", limit=100)\n\n# get the total reward sum for the hotspot, optionally in a given timeframe\nrewards = hotspot.rewards(min_time=\"2022-01-01\", max_time=\"2022-06-01\")\n\n# get hotspots that the given hotspot witnessed over the last 5 days\nwitnessed = hotspot.witnessed()\n\n# ===================================\n\n## sample validator functionality\n\nvalidator = Validator(address=\"51-character-validator-address\")\n\n# get roles (activity) for a hotspot, can optionally provide timeframe and response limit\nroles = validator.roles(limit=200)\n\n```\n\n## Return types\n\nThe Helium API returns either JSON objects (loaded as `dicts`) of data, or `lists` of data. All of the functions in the `hntpy` package that make requests to the Helium API return either:\n\n- `list`\n- `dict`\n- `GeneratorType`\n\nFor requests that have the potential to return large amounts of data, there is the option to provide a `gen=True` argument to the method, which will yield the data in batches (rather than compile and return one single large list). By default, `gen` parameter is set to `False` for all methods.\n\nTo see available return types for specific methods, see method definitions in the respective module's documentation page.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python wrapper for Helium API to simplify interactions with the Helium blockchain.",
    "version": "0.0.9",
    "split_keywords": [
        "helium",
        "crypto",
        "hnt",
        "blockchain"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "b9d316c4861307334f68c7488ebd3caf",
                "sha256": "44536a98bc64bdc9addb296bdc84c6e3d7763d21b75b0af7f456e0b76a24b49e"
            },
            "downloads": -1,
            "filename": "hntpy-0.0.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b9d316c4861307334f68c7488ebd3caf",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7,<4.0",
            "size": 10936,
            "upload_time": "2022-12-03T23:50:03",
            "upload_time_iso_8601": "2022-12-03T23:50:03.274584Z",
            "url": "https://files.pythonhosted.org/packages/a4/b4/b1072e74c9a2aa5ca853b76bffba90645f3d150b74b2643a0dbcac2fc12d/hntpy-0.0.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "3e1f41f341b9ca2a7c7e52ea57a6b2a2",
                "sha256": "ca294fc5ec8ee31ba919e85b2d5ef909f2540ac6934eff8ec77ab9416e8af343"
            },
            "downloads": -1,
            "filename": "hntpy-0.0.9.tar.gz",
            "has_sig": false,
            "md5_digest": "3e1f41f341b9ca2a7c7e52ea57a6b2a2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7,<4.0",
            "size": 9374,
            "upload_time": "2022-12-03T23:50:05",
            "upload_time_iso_8601": "2022-12-03T23:50:05.498408Z",
            "url": "https://files.pythonhosted.org/packages/6e/97/fdd94d341f014e5a1e6b5d8e3d59d20e60690f9fd9c8daa063ee098594b8/hntpy-0.0.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-03 23:50:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "h-morgan",
    "github_project": "hntpy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "hntpy"
}
        
Elapsed time: 0.05334s