Metadata-Version: 2.3
Name: p2pool-api
Version: 0.0.2
Summary: Allows interacting with the P2Pool API.
Project-URL: Homepage, https://github.com/hreikin/p2pool-api
Project-URL: Issues, https://github.com/hreikin/p2pool-api/issues
Author-email: hreikin <hreikin@gmail.com>
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# P2Pool API

This module provides the `P2PoolAPI` object to allow interacting with the P2Pool API.

## Installation

The module can be installed from PyPi or Github with pip:

```
pip install p2pool-api
# or to install from the Github repository
pip install p2pool-api@git+https://github.com/hreikin/p2pool-api.git@main
```

## Usage

API data is updated on initialization and can be updated individually or altogether using the relevant methods. Data is also available as properties to allow accessing the cached endpoint data all at once or as individual items.

```python
import p2pool_api, logging

logging.basicConfig()
logging.getLogger("P2PoolAPI").setLevel(logging.INFO)           # Change to DEBUG to print out all responses when their methods are called
log = logging.getLogger("MyLOG")

api_path = "/path/to/p2pool/api"
x = p2pool_api.P2PoolAPI(api_path)

log.info(x._local_stratum)                                      # Log entire reponse
log.info(x.local_p2p_uptime)                                    # Log property representing individual data from the API
x.get_stats_mod()                                               # Update individual `stats_mod` endpoint
x.get_all_data()                                                # Update all endpoints at once
```