Skip to main content

Support REST calls for asyncio+aiohttp.

Project description

JSON REST framework based on aiohttp (an asyncio (PEP 3156) http server).

aiorest development has stopped

The project always was in experimental status: we have tried to make the proof of concept for aiohttp high level server.

Now the work is done, the most important parts transplanted to aiohttp.web: Request and Response.

Some aiorest features are not supported by aiohttp.web yet: sessions, CORS and security.

We are working hard on the issue by making aiohttp extension libraries for those ones.

We will keep aiorest work on top of aiohttp new versions for a while.

Please report about incompatibility bugs to aiorest github issue tracker – we’ll fix those.

Example usage

Simple REST server can be run like this:

import asyncio
import aiohttp
import aiorest

# define a simple request handler
# which accept no arguments
# and responds with json
def hello(request):
    return {'hello': 'world'}

loop = asyncio.get_event_loop()
server = aiorest.RESTServer(hostname='',

# configure routes
server.add_url('GET', '/hello', hello)
# create server
srv = loop.run_until_complete(loop.create_server(
    server.make_handler, '', 8080))

def query():
    resp = yield from aiohttp.request(
        'GET', '', loop=loop)
    data = yield from resp.read_and_close(decode=True)


this will print {'hello': 'world'} json

See examples for more.



aiorest is offered under the MIT license.


0.4.0 (2015-01-18)

  • The aiorest library development has stopped, use aiohttp.web instead.

  • Update aiorest code to be compatible with aiohttp 0.14 release.

0.3.1 (2014-12-22)

  • Fixed exceptions logging for unhandled errors

0.3.0 (2014-12-17)

  • Made aiorest compatible to aiohttp v0.12

0.2.5 (2014-10-30)

  • Fix response.write_eof() to follow aiohttp changes

0.2.4 (2014-09-12)

  • Make loop keywork-only parameter in create_session_factory() function

0.2.3 (2014-08-28)

  • Redis session switched from asyncio_redis to aioredis

0.2.2 (2014-08-15)

0.1.1 (2014-07-09)

  • Switched to aiohttp v0.9.0

0.1.0 (2014-07-07)

  • Basic REST API

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiorest-0.4.0.tar.gz (12.9 kB view hashes)

Uploaded Source

Built Distribution

aiorest-0.4.0-py3-none-any.whl (17.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page