example.main¶
main.py
Flask API main entrypoint
created 31-mar-2019 by richb@instantlinux.net
Functions
|
All responses get a cache-control header |
Request-setup function - get sessions to database and auth |
|
|
When a flask thread terminates, close the database session |
|
Database setup |
Classes
|
Service registry |
|
Session Manager - for active user sessions |
|
The year, month and day arguments are required. |
-
example.main.
add_header
(response)¶ All responses get a cache-control header
-
example.main.
before_request
()¶ Request-setup function - get sessions to database and auth
-
example.main.
cleanup
(resp_or_exc)¶ When a flask thread terminates, close the database session
-
example.main.
setup_db
(db_url='sqlite:////var/opt/example/example.db', redis_conn=None)¶ Database setup
- Parameters
db_url (str) – URL with db host, credentials and db name
redis_conn (obj) – connection to redis