Skip to main content

The bestest Python PiShock API wrapper and CLI!

Project description

PiShock for Python

Python PiShock Logo

The bestest Python PiShock API wrapper and CLI!

If you have no idea what PiShock is: I'm left wondering how you found this, but it's an ecosystem around using dog shock collars on humans (clearly the better way to use them!).

  • Pythonic, easy-to-use API.
  • Beautiful command-line interface to send shocks/vibrates/beeps, manage share codes, keep someone on their toes with random shocks, interfacing with the PiShock over USB/serial, upgrading firmware, and more!
  • Ticks the boxes: Support for mini-shocks, getting shocker info, and various other undocumented API features. If it's possible to do, this project probably supports it.
  • Local shocking: Drop-in support for the USB serial API instead of HTTP.
  • Battle-tested: I accidentally shocked my balls while developing so you don't have to (I wish this was a joke).
  • High-quality, modern codebase: Type annotations in Mypy strict mode, Linting/Formatting via Ruff, Automated tests with pytest.
  • Made with love: Decent test coverage, CI, nice documentation, …. — I love zappies and I love going the extra mile!
  • Almost official: While this is not an official pishock.com product, I'm the same person who developed the code running on your PiShock that's sending out the shocks.
  • Runs anywhere: Tested on CPython 3.8 to 3.12, on Windows, macOS and Linux. Possibly CircuitPython soon?

Using the CLI to send a vibrate (or a shock, if you dare):

$ pip install pishock
[...]

$ pishock init
👤 PiShock username (your own username): Zerario
🔑 PiShock API key (https://pishock.com/#/account): 964f1513-c76a-48cc-82d4-41e757d4eb04
✅ Credentials saved.

$ pishock code add my-shocker ABCDEF12345
✅  my-shocker    ABCDEF12345

$ pishock vibrate my-shocker --duration 1 --intensity 20
📳

Or via the Python API:

from pishock import PiShockAPI

username = "..."   # from pishock.com
api_key = "..."    # https://pishock.com/#/account
sharecode = "..."  # https://pishock.com/#/control (share button)

api = PiShockAPI(username, api_key)
shocker = api.shocker(sharecode)
shocker.vibrate(duration=1, intensity=10)

For serial USB usage:

from pishock import SerialAPI

shocker_id = 1234  # https://pishock.com/#/control (cogwheel button)

api = SerialAPI()
shocker = api.shocker(shocker_id)
shocker.vibrate(duration=1, intensity=10)

For more, see the documentation.

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

pishock-1.2.1.tar.gz (174.7 kB view details)

Uploaded Source

Built Distribution

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

pishock-1.2.1-py3-none-any.whl (27.3 kB view details)

Uploaded Python 3

File details

Details for the file pishock-1.2.1.tar.gz.

File metadata

  • Download URL: pishock-1.2.1.tar.gz
  • Upload date:
  • Size: 174.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pishock-1.2.1.tar.gz
Algorithm Hash digest
SHA256 6095e5b428509bf3ae34f7fa39c29256eb8de5736b009947ad082ce833f57a77
MD5 ea2714ddb4e8e889f8b76c92dda661d2
BLAKE2b-256 749cfd8f9eb08fe38831a7df098def3324c7d1b527234d392e8daa0a5851b2d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pishock-1.2.1.tar.gz:

Publisher: main.yml on zerario/Python-PiShock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pishock-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: pishock-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 27.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pishock-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f9718376b95dbe5c9d8c17d1c3abb0943a5c6b9cd571e3ea093513ef41ea2c4e
MD5 1d76f60f54222802d967277295d6d542
BLAKE2b-256 b1f92bc9722b640d95a3f8f665de66abb31fd5be25ca3b59e3b70b56e2cd9087

See more details on using hashes here.

Provenance

The following attestation bundles were made for pishock-1.2.1-py3-none-any.whl:

Publisher: main.yml on zerario/Python-PiShock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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