Python3 wrapper around the mempool.space API (V1)
PyPI
pip install pymempoolor from source
git clone https://github.com/holgern/pymempool.git
cd pymempool
python3 setup.py installfrom pymempool import MempoolAPI
mp = MempoolAPI()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 streamFor more details on any command, use the --help option:
pymempool blocks --helphttps://mempool.space/docs/api/rest
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 .
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
Install tox
pip install tox
Run tests
tox
$ pip install pre-commit
$ brew install pre-commit
$ pre-commit --version
pre-commit 2.10.0
$ pre-commit install
pre-commit run --all-files
pre-commit run --show-diff-on-failure --color=always --all-files
pre-commit autoupdate
pre-commit run --show-diff-on-failure --color=always --all-files