June 2017
Intermediate to advanced
446 pages
10h 10m
English
Asynchronous operations are, in my opinion, an advanced topic of Flask. Luckily, Miguel Grinberg (https://blog.miguelgrinberg.com/), whose Flask work I am a big fan of, provides many posts and examples on his blog and GitHub. For asynchronous operations, the example code in chapter9_8.py referenced Miguel's GitHub code on the Raspberry Pi file (https://github.com/miguelgrinberg/oreilly-flask-apis-video/blob/master/camera/camera.py) for the background decorator. We start by importing a few more modules:
from flask import Flask, url_for, jsonify, request,\ make_response, copy_current_request_context...import uuidimport functoolsfrom threading import Thread
The background decorator takes in a function and runs it as a ...
Read now
Unlock full access