pyrest / pyrest / integration /

import cherrypy
from pyrest.pyrest import get_handlers, requesthandler

API = None #This should be set to a PyRest backend API if used as WSGI application

class PyRest(object):
    def __init__(self, api):
        self._handlers = get_handlers(api)
    def index(self):
        return "Awesome API..."

    def api(self, resource, *pathargs, **kwargs):
        method = cherrypy.request.method.lower()
        response = requesthandler(self._handlers, method, resource, *pathargs, **kwargs)
        cherrypy.response.status = response.status
        return response.content = True = True

if __name__ == '__main__':
    from pyrest.examples import hg
    CONF = {
    'global': {
        'server.socket_host': '',
        'server.socket_port': 8888,

    ROOT = PyRest(hg)

    cherrypy.quickstart(ROOT, '/', CONF)
#Not actually working right now
def application(environ, start_response):
  cherrypy.tree.mount(PyRest(), '/', None)
  return cherrypy.tree(environ, start_response)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.