Pourquoi J’aime Bien Utiliser Flask
def post_postprocessor(updated_user=None, **kw):
socketio.emit('update_user_representation', updated_user, namespace="/user")
with app.app_context():
blueprint_user = manager.create_api_blueprint(models.User,
methods=['GET', 'POST', 'PUT', 'DELETE'],
allow_delete_many = True,
postprocessors = {
'POST': [post_postprocessor]
})
app.register_blueprint(blueprint_user)
if __name__ == "__main__":
socketio.run(app,
host=conf.WEBSERVER_HOST,
port=conf.WEBSERVER_PORT,
debug=conf.WEBSERVER_DEBUG)
Voici une API ReSTful pour un modèle (User) qui permet de propager vers différents clients les modifications effectuées sur un object.
Je trouve ça vraiment beau.
Questions, comments? Please use my public inbox by sending a plain-text email to ~cedric/public-inbox@lists.sr.ht.