{"library":"sshkeyboard","title":"SSH Keyboard Input Capture","type":"library","description":"sshkeyboard is a small, cross-platform Python library designed for capturing key presses and releases, primarily intended for use within SSH sessions but also functional in local terminal environments. It provides simple callback mechanisms for handling key events, enabling interactive command-line applications. The current version is 2.3.1, with ongoing maintenance for bug fixes and compatibility.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install sshkeyboard"],"cli":null},"imports":["from sshkeyboard import listen_keyboard"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":null,"github":"https://github.com/ollipal/sshkeyboard","docs":null,"changelog":null,"pypi":"https://pypi.org/project/sshkeyboard/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"from sshkeyboard import listen_keyboard\nimport time\n\ndef on_press(key):\n    print(f\"Key '{key}' pressed\")\n\ndef on_release(key):\n    print(f\"Key '{key}' released\")\n\nprint(\"Listening for 5 seconds... Press any key.\")\n# Listens for key presses and releases for a duration of 5 seconds\nlisten_keyboard(on_press=on_press, on_release=on_release, until='5 seconds')\nprint(\"Finished listening.\")","lang":"python","description":"This example demonstrates how to set up `sshkeyboard` to listen for key presses and releases for a specified duration (5 seconds). It defines two callback functions, `on_press` and `on_release`, which are invoked when a key event occurs.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}