Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(9)  |  Call(8)  |  Derive(0)  |  Import(1)

        def register_api(mod, view, **kwargs):
    name = view.__name__.lower()[:-8]  # remove _api from the end
    endpoint = kwargs.get('endpoint', "%s_api" % name)
    url = "/%s" % kwargs.get('url', _pluralize(name))
    setattr(view, '_url', url)  # need this for 201 location header
    view_func = view.as_view(endpoint)

    mod.add_url_rule("%s" % url, view_func=view_func,
                     methods=['GET', 'POST', 'OPTIONS'])
    mod.add_url_rule('%s/' % url,
                     view_func=view_func,
                     methods=['GET', 'PATCH', 'PUT', 'DELETE', 'OPTIONS'])
    mod.add_url_rule('%s/<_lookup>' % url,
                     view_func=view_func,
                     methods=['GET', 'PATCH', 'PUT', 'DELETE', 'OPTIONS'])
        


src/f/l/flask_slither-HEAD/tests.py   flask_slither(Download)
from flask.ext.slither.authorization import ReadOnlyAuthorization
from flask.ext.slither.resources import BaseResource
from flask.ext.slither import register_api
from pymongo import MongoClient
from werkzeug.routing import BaseConverter
        if not kwargs.get('ignore_resource', False):
            # register test resource
            register_api(app, Resource, url="test")
        return app
 
                return {'_id': rid}
 
        register_api(self.app, R, url="test")
 
        obj_id = self.app.db[collection_name].find_one(
                return {'_id': {'$in': ids}}
 
        register_api(self.app, R, url="test")
 
        response = self.client.get('/test')
                return {'_id': {'$in': ids}}
 
        register_api(self.app, R, url="test")
 
        obj_id = self.app.db[collection_name].find_one(