一个人还没有死,他的名字还在说话。
flask-clacks的Python项目详细描述
烧瓶咔哒声
一个人的名字还在念的时候,他还没有死。
这是一个非常简单的烧瓶扩展,它在 你网站的回复。
- 自由软件:麻省理工学院许可证
- 文档:https://flask-clacks.readthedocs.io。
功能
此包公开了一个烧瓶扩展,默认情况下,该扩展会添加标题 X-Clacks-Overhead: GNU Terry Pratchett适用于所有路线、所有来源和 方法。
- 您可以在开销中添加额外的名称
- 您可以装饰单独的线路,使其具有架空
安装
使用pip或easy_install安装扩展。
$ pip install -U flask-clacks
使用量
适用于所有路线,只在头顶发送特里·普拉切特的名字。
fromflaskimportFlaskfromflask-clacksimportClacksapp=Flask(__name__)Clacks(app)@app.route("/")defindex():# Will have the header added to the responsereturn"OK"
适用于所有路线,将Terry Pratchett和John Dearheart的名字发送到 头顶上。
fromflaskimportFlaskfromflask-clacksimportClacksapp=Flask(__name__)Clacks(app,names=('John Dearheart',))@app.route("/")defindex():# Will have the the clacks overhead header for both Terry and Johnreturn"OK"
应用于特定的路由,在不同的响应上发送不同的名称。
fromflaskimportFlaskfromflask-clacksimportclacksapp=Flask(__name__)@app.route("/terry/")@clacksdefterry():# Will have a clacks overhead header for Terryreturn"OK"@app.route("/terry-and-john/")@clacks(names=('John Dearheart',))defterry_and_john():# Will have a clacks overhead header for both Terry and Johnreturn"OK"@app.route("/no-one/")defno_one():# Will not have clacks overhead headersreturn"OK"
历史记录
1.0.0(2017-04-26)
- pypi上的第一个版本。
1.0.1(2017-04-26)
- 学习travis、pypi和tox的工作原理
- 固定小配置项