zerario / Python-PiShock

The bestest Python PiShock API wrapper and CLI!
https://python-pishock.readthedocs.io/
3 stars 1 forks source link

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!).


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.