python pip install Flask-StatHat
from flask_stathat import StatHat stathat = StatHat() stathat.init_app(app) # or stathat = StatHat(app)
@app.route('/') def index(): stathat.count('some_stat', 1) stathat.value('some_value', 9001) # The stathat requests won't be sent until the flask request # has been processed and no exceptions were raised ...
app.config.update(STATHAT_EZ_KEY='STAHAT_EZ_KEY')
Flask-StatHat
will use grequests
if it's installed