MongoDB基于Flask的restful API

madame的Python项目详细描述


madame是MongoDB基于烧瓶的动态restful API。



:作者:asdine el hrychy
:版本:0.1


-**json验证**
-**缓存**
-**版本控制**
-**默认为只读**


crud
----
madame支持内置crud操作。


====
==
创建post
read get
更新补丁
update*post
delete delete
======


*update方法可以使用post或patch,无论用户是否更新整个文档。


schemas
----
dames将数据库模式与代码分开,并使用json来描述它们。
要验证数据,它使用强模式验证库:`validictory<;https://github.com/sunlightlabs/validictory>;`。:

{
"联系人":{
"标题":"联系人",
"描述":"我的联系人列表",
"架构":{
"类型":"对象",
"属性":{
"名字":{
"type":"string",
"minlength":1,
"maxlength":10
},
"lastname":{
"type":"string",
"minlength":1,
"maxlength":15,
"required":true
},
"phone number":{
"type":"string",
"format":"phone"
}
}
}
}
}
}



dynamic
----
您可以添加和删除新架构,而无需关闭服务器并立即使用它们。:

>;>import requests,json

>;>data={
"pets":
{
"title":"pets",
"description":"my pets",
"schema":
{
"type":"对象",
"属性":{
"名称":{
"类型":"字符串",
"最小长度":1,
"最大长度":15,
"必选":true
}
}
}
}
}
}
>;headers={'content-type':'application/json'}
>;>;r=requests.post('http://localhost:5000/',data=json.dumps(data),headers=headers)
>;>print r.status_code
201




$curl-i-d{"name":"betise"}'-h"内容类型:application/json"http://localhost:5000/pets/
http/1.0 201创建
内容类型:application/json
内容长度:263
etag:"17c62e0fd3f85bf0f0f7db76fc2c90027f3309a83c"
服务器:werkzeug/0.8.3python/2.7.3
日期:2013年1月4日星期五格林尼治标准时间15:36:00

{
"标题":"已创建文档","链接":
[
{
{
"方法":["获取","发布","删除"],
"ref":"http://localhost:5000/pets/",
"description":"您在这里。",
"rel":"self",
"title":"pets"
},
{
"ref":"http://localhost:5000/pets/50e6e00ef3c414fcf66b45",
"rel":"item"
}
],
}




ng
---------
夫人使用MongoDB选项进行筛选和排序。::

$curl http://localhost:5000/pets/?限值=1;skip=20

madame

app=madame('/v1')
app.run()



flask和ajax
----
将madame用作网站的ajax扩展。
由于madame是在flask上构建的,您仍然可以将其用作普通网站。



导入呈现模板

app=madame('/ajax')

@app.route('/')
def index():
返回呈现模板('index.html')


if u name_="main":
app.run()


future
----
-高度可定制
-认证
-分页
-``get/<;collection>;/<;chosenidentifier>;``

等等。

反馈
--
任何评论或建议都将非常感谢!

文档
----
完整的文档可在"https://madame.readthedocs.org<;https://madame.readthedocs.org>;""madame是麻省理工学院授权的"。请参阅"license<;https://github.com/asdine/madame/blob/master/license>;``了解详细信息。

credits
----
`flask<;http://flask.pocoo.org/>;``u

`pymongo<;http://api.mongodb.org/python/current/>;``u

`validictory<;https://github.com/sunlightlabs/validictory>;`

----
madame由asdine el hrychy开发。
有关详细信息,请参阅``authors<;https://github.com/asdine/madame/blob/master/authors>;`。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
HTTP标头的java InputStream未终止   java测试SpringWebListener   具有定义的替换编号Java的regex ReplaceAll   在java中使用contains()方法   java在选择查询中使用JoinColumn字段   具有用户的java Start-stop demon不是以给定用户启动   java glBufferData生成GL\u无效\u操作   java中循环代码的循环   Java位无符号移位(>>>>)会产生奇怪的结果   java HQL使用点分隔符从select获取结果   条纹、弹簧、玩耍(或?):使用哪种高性能Java框架?   广播接收机中的java停止服务   java回收器视图占据整个屏幕。不在上面显示我的UI元素   java使MySQL查询更快   java MappedByteBuffer查询   java递归算法问题