{"library":"pysher","title":"Pysher","description":"Pysher is a Python module for handling Pusher websockets, based on Erik Kulyk's PythonPusherClient. It provides client-side functionality to connect to Pusher channels, subscribe to events, and bind callbacks to handle real-time data. The project is currently in maintenance mode, welcoming PRs for fixes, updates, and features, with releases occurring periodically for merged improvements.","language":"python","status":"maintenance","last_verified":"Sat May 16","install":{"commands":["pip install pysher"],"cli":null},"imports":["import pysher\npusher = pysher.Pusher(...)"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import pysher\nimport os\nimport time\nimport logging\n\n# Configure logging to see Pysher's internal communication\nroot = logging.getLogger()\nroot.setLevel(logging.INFO)\nch = logging.StreamHandler()\nroot.addHandler(ch)\n\n# Replace with your actual Pusher App Key and Cluster\nAPP_KEY = os.environ.get('PUSHER_APP_KEY', 'your_app_key')\nCLUSTER = os.environ.get('PUSHER_CLUSTER', 'mt1') # e.g., 'mt1', 'eu', 'ap1'\n\nif APP_KEY == 'your_app_key':\n    print(\"WARNING: Please set PUSHER_APP_KEY environment variable or replace 'your_app_key' in the code.\")\n\ndef my_func(*args, **kwargs):\n    \"\"\"Callback function to process messages from a subscribed event.\"\"\"\n    print(f\"Processing Args: {args}\")\n    print(f\"Processing Kwargs: {kwargs}\")\n\ndef connect_handler(data):\n    \"\"\"Callback function when connection is established.\"\"\"\n    print(f\"Connected to Pusher! Connection data: {data}\")\n    # Subscribe to a channel after successful connection\n    channel = pusher.subscribe('my-channel')\n    # Bind a callback to a specific event on that channel\n    channel.bind('my-event', my_func)\n    print(\"Subscribed to 'my-channel' and bound 'my-event'.\")\n\n# Initialize Pusher client\npusher = pysher.Pusher(APP_KEY, cluster=CLUSTER)\n\n# Bind the connect handler to the 'pusher:connection_established' event\npusher.connection.bind('pusher:connection_established', connect_handler)\n\n# Connect to Pusher\nprint(\"Connecting to Pusher...\")\npusher.connect()\n\ntry:\n    while True:\n        # Keep the main thread alive to allow websocket client to run\n        time.sleep(1)\nexcept KeyboardInterrupt:\n    print(\"\\nDisconnecting Pysher.\")\n    pusher.disconnect()\n    print(\"Disconnected.\")\n","lang":"python","description":"This quickstart demonstrates how to connect to Pusher, subscribe to a channel, and bind a callback function to an event. It includes basic logging to observe the connection process and uses environment variables for the Pusher App Key for secure credentials handling.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-16","installed_version":"1.0.8","pypi_latest":"1.0.8","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":3.1,"avg_import_s":0.61,"wheel_type":"sdist"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pysher","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.58,"mem_mb":10.6,"disk_size":"23.3M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pysher","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":2.8,"import_time_s":0.39,"mem_mb":10.6,"disk_size":"24M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pysher","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.74,"mem_mb":11.9,"disk_size":"26.1M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pysher","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":2.7,"import_time_s":0.64,"mem_mb":11.9,"disk_size":"27M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pysher","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.67,"mem_mb":11.6,"disk_size":"15.9M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pysher","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":3.6,"import_time_s":0.7,"mem_mb":11.6,"disk_size":"16M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pysher","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.63,"mem_mb":12,"disk_size":"15.6M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pysher","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":3.3,"import_time_s":0.63,"mem_mb":12,"disk_size":"16M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pysher","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.58,"mem_mb":10.3,"disk_size":"22.6M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pysher","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":3.2,"import_time_s":0.54,"mem_mb":10.3,"disk_size":"23M"}]}}