mirror of
https://github.com/sprockets/sprockets.handlers.heartbeat.git
synced 2024-11-28 19:29:51 +00:00
8bb37d30ed
- Update .travis.yml with pypi password - Update example in documentation and README - Add information in the history.rst file - Update the requirements, removing sprockets and adding tornado - Set the version in setup.py
24 lines
586 B
ReStructuredText
24 lines
586 B
ReStructuredText
Examples
|
|
========
|
|
The following example demonstrates how to create a method that is invoked on
|
|
each call to ``/heartbeat`` in a web application.
|
|
|
|
.. code:: python
|
|
|
|
from sprockets.handlers import heartbeat
|
|
from tornado import web
|
|
|
|
|
|
def check_database():
|
|
"""Any check method should return a bool specifying the check is ok.
|
|
|
|
:rtype: bool
|
|
|
|
"""
|
|
return True
|
|
|
|
# Register the check method
|
|
heartbeat.register_callback(check_database)
|
|
|
|
# Create a Tornado application
|
|
app = web.Application([('/heartbeat', heartbeat.HeartbeatHandler)])
|