创建位图分析库的简单接口的烧瓶扩展
Flask-Bitmapist的Python项目详细描述
Flask扩展,创建到Bitmapist分析库的简单接口。
关于
[A] Python library [that] makes it possible to implement real-time, highly scalable analytics that can answer the following questions:
- Has user 123 been online today? This week? This month?
- Has user 123 performed action “X”?
- How many users have been active this month? This hour?
- How many unique users have performed action “X” this week?
- What % of users that were active last week are still active?
- What % of users that were active last month are still active this month?
- Which users performed action “X”?
安装
$ pip install flask-bitmapist
用法
示例应用程序:
fromflaskimportFlaskfromflask_bitmapistimportFlaskBitmapist,markapp=Flask(__name__)flaskbitmapist=FlaskBitmapist()flaskbitmapist.init_app(app)@app.route('/')@mark('index:visited',1)# current_user.iddefindex():"""using the mark decorator, the first argument is the event and the second is the id of the current_user """return'Hello, world!'if__name__=='__main__':app.run()
有关markdecorator的文档,请查看mark_eventBitmapist function。
配置
Name | Type | Description |
---|---|---|
^{tt3}$ | ^{tt4}$ | Name of Redis System; defaults to ^{tt5}$ |
^{tt6}$ | ^{tt4}$ | URL to connect to Redis server; defaults to ^{tt8}$ |
^{tt9}$ | ^{tt10}$ | Tells Bitmapist to track hourly; can also be passed to ^{tt1}$ (e.g., ^{tt12}$) |
^{tt13}$ | ^{tt10}$ | Disables registration of default Bitmapist Blueprint |
队列蓝图
bitmapist的一个优点是它的简单位操作api和您得到的数据队列。 有关群组的更多信息,请访问Bitmapist README。
初始化flask-bitmapist扩展时,会向应用程序注册蓝图。
Name | Path | Description |
---|---|---|
index | ^{tt16}$ | Default Bitmapist index |
cohort | ^{tt17}$ | Demo cohort retrieval and heatmap generation |
测试
要运行测试,请确保在端口6399上运行redis:
$ redis-server --port 6399
然后您只需运行:
$ python setup.py test
若要为测试生成假数据,请运行:
$ python scripts/seed.py
文档
完整的烧瓶位图列表文档可在ReadTheDocs找到。
贡献
如果您对flask bitmapist感兴趣,请从创建问题here开始。谢谢!
发布历史记录
0.1.0(2016-03-30)
- 第一次释放。