Skip to main content

Python Api for mempool.space

Project description

mempool.space API wrapper

codecov PyPi Version

Python3 wrapper around the mempool.space API (V1)

Installation

PyPI

pip install pymempool

or from source

git clone https://github.com/holgern/pymempool.git
cd pymempool
python3 setup.py install

Usage

from pymempool import MempoolAPI
mp = MempoolAPI()

CLI Commands

The package provides a command-line interface with various commands to interact with the mempool.space API.

# Display recent Bitcoin blocks as ASCII art with statistics
pymempool blocks --limit 5

# Display mempool blocks as ASCII art with statistics
pymempool mempool-blocks

# Get information about the next Bitcoin halving
pymempool halving

# Get current mempool information
pymempool mempool

# Get current fee recommendations
pymempool fees

# Get details about a specific Bitcoin address
pymempool address <address>

# Get details about a specific block
pymempool block <block_hash>

# Stream live Bitcoin data from the WebSocket API
pymempool stream

For more details on any command, use the --help option:

pymempool blocks --help

API Documentation

https://mempool.space/docs/api/rest

Test Suite

Set up the test environment

Install the test-runner dependencies:

pip3 install -r requirements-test.txt

Then make the pymempool python module visible/importable to the tests by installing the local dev dir as an editable module:

# from the repo root
pip3 install -e .

Running the test suite

Run the whole test suite:

# from the repo root
pytest

Run a specific test file:

pytest test/test_this_file.py

Run a specific test:

pytest test/test_this_file.py::test_this_specific_test

Running tests with tox

Install tox

pip install tox

Run tests

tox

License

MIT

Pre-commit-config

Installation

$ pip install pre-commit

Using homebrew:

$ brew install pre-commit
$ pre-commit --version
pre-commit 2.10.0

Install the git hook scripts

$ pre-commit install

Run against all the files

pre-commit run --all-files
pre-commit run --show-diff-on-failure --color=always --all-files

Update package rev in pre-commit yaml

pre-commit autoupdate
pre-commit run --show-diff-on-failure --color=always --all-files

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

pymempool-0.2.1.tar.gz (39.6 kB view details)

Uploaded Source

Built Distribution

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

pymempool-0.2.1-py3-none-any.whl (26.4 kB view details)

Uploaded Python 3

File details

Details for the file pymempool-0.2.1.tar.gz.

File metadata

  • Download URL: pymempool-0.2.1.tar.gz
  • Upload date:
  • Size: 39.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.24

File hashes

Hashes for pymempool-0.2.1.tar.gz
Algorithm Hash digest
SHA256 f2d55f73205e98976022f820b5f1ded7cafb994facc6b0e5e78b009870535845
MD5 386d91eb49fa7bed2d0591a628ae5ef7
BLAKE2b-256 856418c3558ce12ec4cd4c8e70ec3732600f8653c5eb938b342aafd4681011ca

See more details on using hashes here.

File details

Details for the file pymempool-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: pymempool-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 26.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.24

File hashes

Hashes for pymempool-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 95a5fd4e3e76e8ffd9f27286aecf87f2ab226bee75c6d991f8589e48e43b5745
MD5 c84203b683212dd8e088543d1bf8f41c
BLAKE2b-256 5274fcfda0fe858b8fe80f0c0da154f32c4f22bee1d1c6878586ed6452790b70

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