webhook-listener
raw JSON → 1.2.0 verified Sat May 09 auth: no python
A lightweight Python web server module to listen for webhooks and forward incoming requests to predefined callback functions. Currently at version 1.2.0, with infrequent releases.
pip install webhook-listener Common errors
error ImportError: No module named webhook_listener ↓
cause The package installed as 'webhook-listener' but the import uses underscores. This error appears if pip install failed or if import is misspelled.
fix
Run
pip install webhook-listener and then use from webhook_listener import Listener. error cherrypy._cpdispatch.LateParamCallback: The config entry 'tools.sessions.on' refers to an unknown tool ↓
cause Incorrect configuration or conflicting cherrypy settings when using custom endpoints.
fix
Avoid setting cherrypy config directly; rely on webhook_listener's default config. If error persists, upgrade to latest version.
Warnings
deprecated In v1.0.0 a warning about cherrypy bus on exit was fixed. Older versions may show a stack trace when the listener is stopped. ↓
fix Upgrade to 1.0.0 or newer.
gotcha The import uses underscores (webhook_listener) but the PyPI package name uses hyphens (webhook-listener). Common mistake is to write `import webhook-listener` which is invalid Python syntax. ↓
fix Use `from webhook_listener import Listener`.
gotcha SSL support requires both `ssl_certificate` and `ssl_key` parameters. If only one is provided, the listener crashes. ↓
fix Provide both files or omit both to run without SSL.
Imports
- Listener
from webhook_listener import Listener
Quickstart
from webhook_listener import Listener
def handle_webhook(data):
print("Received:", data)
return {"status": "ok"}
listener = Listener(
port=8080,
endpoint="/webhook",
callback=handle_webhook,
ssl_certificate="/path/to/cert.pem",
ssl_key="/path/to/key.pem"
)
listener.start()