Skip to main content

Skunk Works

                         _..._ ___
                       .:::::::.  `"-._.-''.
                  ,   /:::::::::\     ':    \                     _._
                  \:-::::::::::::\     :.    |     /|.-'         /:::\ 
                   \::::::::\:::::|    ':     |   |  /           |:::|
                    `:::::::|:::::\     ':    |   `\ |    __     |\::/\ 
                       -:::-|::::::|    ':    |  .`\ .\_.'  `.__/      |
                            |::::::\    ':.   |   \ ';:: /.-._   ,    /
                            |:::::::|    :.   /   ,`\;:: \'./0)  |_.-/
                            ;:::::::|    ':  |    \.`;::.   ``   |  |
                             \::::::/    :'  /     _\::::'      /  /
                              \::::|   :'   /    ,=:;::/           |
                               \:::|   :'  |    (='` //        /   |
                                \::\   `:  /     '--' |       /\   |
  GITHUB.COM/SKUNK-INK           \:::.  `:_|.-"`"-.    \__.-'/::\  |
░▒█▀▀▀█░▒█░▄▀░▒█░▒█░▒█▄░▒█░▒█░▄▀  '::::.:::...:::. '.       /:::|  |
░░▀▀▀▄▄░▒█▀▄░░▒█░▒█░▒█▒█▒█░▒█▀▄░   '::/::::::::::::. '-.__.:::::|  |
░▒█▄▄▄█░▒█░▒█░░▀▄▄▀░▒█░░▀█░▒█░▒█     |::::::::::::\::..../::::::| /
                                     |:::::::::::::|::::/::::::://
  ░▒█░░▒█░▒█▀▀▀█░▒█▀▀▄░▒█░▄▀░▒█▀▀▀█  \:::::::::::::|'::/::::::::/
  ░▒█▒█▒█░▒█░░▒█░▒█▄▄▀░▒█▀▄░░░▀▀▀▄▄  /\::::::::::::/  /:::::::/:|
  ░▒▀▄▀▄▀░▒█▄▄▄█░▒█░▒█░▒█░▒█░▒█▄▄▄█ |::';:::::::::/   |::::::/::;
              HANDSHAKE API WRAPPER |:::/`-:::::;;-._ |:::::/::/
                                    |:::|  `-::::\   `|::::/::/
                                    |:::|     \:::\   \:::/::/
                                   /:::/       \:::\   \:/\:/
                                  (_::/         \:::;__ \\_\\___
                                  (_:/           \::):):)\:::):):)
                                   `"             `""""`  `""""""`      

Install

Install the handywrapper package using PIP:

pip install handywrapper

Tracks the hsd v8.0.0 API surface. Requires Python 3.6+.

From source, for development:

git clone https://github.com/skunk-ink/handywrapper.git
cd handywrapper
pip install -e .[test]

Project Layout

The handywrapper package is split into a few small modules:

Module Contents
handywrapper/node.py hsd — full-node REST + RPC client
handywrapper/wallet.py hsw — wallet REST + RPC client
handywrapper/_http.py Shared get/post/put/patch/delete primitives both classes build on
handywrapper/exceptions.py HandywrapperAPIError, HandywrapperConnectionError, HandywrapperDecodeError
handywrapper/api.py Compatibility shim — from handywrapper import api; api.hsd(...) still works

hsd and hsw can also be imported directly: from handywrapper import hsd, hsw.

See CHANGELOG.md for what changed since 1.x — the 2.0.0 release is a breaking rewrite to match hsd v8.0.0.

Usage

For more information on using the Handshake API, visit the Handshake API Docs

# Import — either style works
from handywrapper import hsd, hsw
# from handywrapper import api  (back-compat: api.hsd(...), api.hsw(...))
# Use default ip and port

node = hsd('api-key')
wallet = hsw('api-key')
# Or specify host, port, and request timeout (seconds, default 30)

node = hsd('api-key', '0.0.0.0', 14037, timeout=10)
wallet = hsw('api-key', '0.0.0.0', 14039, timeout=10)
# Then use

response = node.getInfo()
print(response)

response = wallet.resetAuthToken(passphrase='secret123', id='primary')
print(response)

Error Handling

Failed requests raise an exception instead of returning an error dict:

  • HandywrapperAPIError — hsd/hsw returned a non-2xx response. Carries .status_code, .url, and .body (the parsed error payload, when available).
  • HandywrapperConnectionError — the node/wallet could not be reached.
  • HandywrapperDecodeError — a 2xx response body wasn't valid JSON.
from handywrapper import hsd, HandywrapperAPIError

node = hsd('api-key')

try:
    response = node.getBlockByHashOrHeight('not-a-real-block')
except HandywrapperAPIError as e:
    print(e.status_code, e.body)

Testing

pip install -e .[test]
pytest

The suite mocks HTTP (via responses) and covers every public method on both hsd and hsw, asserting the exact verb, path, query params, and body each one sends.

Release files for handywrapper 2.0.0

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

Source distribution (sdist)

Source distribution for handywrapper 2.0.0
File Size Uploaded
handywrapper-2.0.0.tar.gz 41.1 kB Details

Built distribution (wheel)

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

Total release size: 70.7 kB

Release files / handywrapper-2.0.0.tar.gz

Download URL handywrapper-2.0.0.tar.gz
Size 41.1 kB
Tags Source
SHA-256 checksum
How to use checksums
96bfa2f41a78471ad15c4023f035083bfb484c29d3f5a6284aaa91fcaff78173
BLAKE2b-256 checksum
How to use checksums
437b9a8ef13dfa5b482bdfd7a9838addc3cdc354c8da5943f94649cff657ccba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / handywrapper-2.0.0-py3-none-any.whl

Download URL handywrapper-2.0.0-py3-none-any.whl
Size 29.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b35ba7052f2cfa07bb752789f4f82aae99502c53375371fc01eb1ddd89d91c95
BLAKE2b-256 checksum
How to use checksums
9035bff67929d3040f500fff8ff60c13f4988f0146fc0acb7e7356750bcd0c44
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.0.6

1 release file

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