用于restful api的api操场

django-api-playground的Python项目详细描述


为restful api创建api浏览器的django应用程序。

与任何restful api一起工作。例如,您可以使用此应用程序为基于tastype的api创建api资源管理器。

演示:http://api-playground-demo.hipo.biz

https://github.com/hipo/Django-API-Playground/raw/master/docs/images/api-playground-2.png

说明

要启动并运行此应用程序,请执行以下步骤:

从PIP安装:

pip install django-api-playground

或来源:

pip install git+git://github.com/Hipo/Django-API-Playground.git

添加到已安装的应用程序:

INSTALLED_APPS =(
    # ...

    'apiplayground',
)

安装完成。现在可以定义api模式了。

第一步,创建一个url:

# urls.py

from api.playgrounds import ExampleAPIPlayground

urlpatterns = patterns('',
    (r'api-explorer/', include(ExampleAPIPlayground().urls)),
)

第二步,为api定义一个子类:

# api/playgrounds.py

from apiplayground import APIPlayground

class ExampleAPIPlayground(APIPlayground):

    schema = {
        "title": "API Playground",
        "base_url": "http://localhost/api/",
        "resources": [
            {
                "name": "/feedbacks",
                "description": "This resource allows you to manage feedbacks.",
                "endpoints": [
                    {
                        "method": "GET",
                        "url": "/api/feedbacks/{feedback-id}",
                        "description": "Returns a specific feedback item"
                    },
                    {
                        "method": "POST",
                        "url": "/api/feedbacks/",
                        "description": "Creates new feedback item",
                        "parameters": [{
                            "name": "title",
                            "type": "string"
                        },
                        {
                            "name": "resource",
                            "type": "string"
                        },
                        {
                           "name": "description",
                           "type": "string"
                        }]
                    }
                ]
            },
        ]
    }

就这些。很快就会有更详细的文件。

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

推荐PyPI第三方库


热门话题
JavaPax考试:从非标准Maven存储库解析Karaf特性存储库(XML文件)   java Spring启动Bean创建异常   java中将ArrayList转换为数组的方法   Android Studio的java Unity插件。   java在CheckStyle中从方法计数中排除getter和setter   HibernateJava。sql。SQLSyntaxErrorException:表/视图“序列”不存在   与命令行程序Java vs C通信   java WebView膨胀异常   java在O(n)java8流中寻找两个列表的交集   java使用Gradle运行单元测试时,最大堆大小在哪里设置?   ssl加载java应用程序(CXF)内的jks文件   CI:Jenkins Git:Simple Java项目:希望在特定时间在脚本上发送消息   java根据位置更改数字   java按数值排序字符串数组   macos java版本“1.6.0_65”是否与java 6模棱两可?   Cassandra中的java时间戳