Welcome to Chilero!

Chilero is a minimalistic HTTP framework, a thin layer on top of the aiohttp framework. Based on asyncio, chilero works with single-threaded concurrent code using coroutines.

Simplicity is core principle of chilero (and must be for the eternity), just take a look at the following sample and judge by yourself:

from chilero import web


class Hello(web.View):

    def get(self):
        return web.Response('Hello World!')


routes = [
    ['/', Hello]
]

web.run(web.Application, routes)

Beyond the constraints given by asyncio and aiohttp, chilero is not imposing the usage of any additional package nor platform, you should be free to integrate with any third party library for asyncio.

Contents:

Chilero’s API

chilero.web.application module

class chilero.web.application.Application(routes=None, **kwargs)

Bases: aiohttp.web.Application

dispatcher(cls, method, parent=None)
register_routes(route, parent=None)
reverse(name, query=None, **kwargs)

chilero.web.resource module

class chilero.web.resource.CollectionResponse(resource, extra_content=None, **kwargs)

Bases: chilero.web.resource.ResourceResponse

class chilero.web.resource.EntityResponse(resource, body=None, extra_content=None, **kwargs)

Bases: chilero.web.resource.ResourceResponse

class chilero.web.resource.Resource(*args, **kwargs)

Bases: chilero.web.view.View

Base class for HTTP Resources (RESTful?)

default_kwargs_for_urls()

Default keyword arguments for building the resource’s urls.

Returns:dict
get_definition_url(resource=None, **kwargs)
get_encoder_class()
get_index_url(resource=None, **kwargs)

Builds the url of the resource’s index.

Parameters:
  • resource – name of the resource or None
  • kwargs – additional keyword arguments to build the url
Returns:

url of the resource’s index

get_nested_resources()
get_nested_urls()
get_object_url(id, resource=None, **kwargs)
get_parent()

Returns the url to the parent endpoint.

get_resource_name()
get_self_url()
has_nested_resources()
id_pattern = '{id}'
is_collection()
is_entity()

Hacky solution to detect if current instance of the class is an entity or collection endpoint.

nested_collection_resources = None
nested_entity_resources = None
resource_definition(**kwargs)
response(*args, **kwargs)
class chilero.web.resource.ResourceResponse(resource, kind=None, extra_content=None, **kwargs)

Bases: chilero.web.response.JSONResponse

chilero.web.response module

class chilero.web.response.HTMLResponse(body, **kwargs)

Bases: chilero.web.response.Response

class chilero.web.response.JSONResponse(data, cls=None, **kwargs)

Bases: chilero.web.response.Response

class chilero.web.response.JavaScriptResponse(data, **kwargs)

Bases: chilero.web.response.Response

class chilero.web.response.Response(body=None, **kwargs)

Bases: aiohttp.web_response.Response

chilero.web.test module

class chilero.web.test.WebTestCase(methodName='runTest')

Bases: unittest.case.TestCase

application

alias of Application

create_server()
find_unused_port()
full_url(path)
initialize_application()
routes = []
setUp()
tearDown()
chilero.web.test.asynctest(f)

chilero.web.view module

class chilero.web.view.View(request, app, *args, **kwargs)

Bases: object

get_full_url(path)

Indices and tables