sprockets.handlers.heartbeat/docs/examples.rst
Gavin M. Roy 8bb37d30ed Cleanup for release
- 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
2014-10-14 12:16:12 -04:00

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)])