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.0.2.tar.gz (23.2 kB view details)

Uploaded Source

Built Distribution

pishock-1.0.2-py3-none-any.whl (27.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pishock-1.0.2.tar.gz
  • Upload date:
  • Size: 23.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for pishock-1.0.2.tar.gz
Algorithm Hash digest
SHA256 153b790acd0b6aa187f895a2cde8fcb2d97fa8d5d9e981b7c63ef9e304eb63ac
MD5 bd490b9c089b152d7445af7bee8ea2e6
BLAKE2b-256 eb40691bd495af99dd41527fbdece6663f731e9da2e42affb8e5288e7f2536b3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pishock-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 27.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for pishock-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bba9f8620638e2b55cb1e58054a0163ea09042be9424f425dbfb3beb04e4f5bb
MD5 fdccb0ac12df949aaa5fc9faacee8e4e
BLAKE2b-256 cec01cf459585d92e690f2c043ed363ec92b8564b117ea73a9b33d3139e6c419

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page