Great REST API helper for Python asycio


  • Supports Bottle like decorator routing system.
async def get_products(product_id:int):
        # Do some stuff
  • Supports cherryPy like function parameter mapping to http input.
async def register_location(lat:float, lng:float):
        #Register location in persistence
  • Uses Python type annotation for function parameters.
  • Supports both class attribute and single parameter for input arguments.
async def add_product(product:Product):
        #product is an pbject of DTO type Product with all attributes.
  • Capable of assigning some arguments to request header value.
@post('/auth', from_header=('username','password'))
async def login(username:str, password:str):
        #Validate user login
  • Easily access inner http request everywhere like bottle.
from asyncrest import request

async def get_dummies():
        x = request.headers
  • Capable of running sync functions.
@get('double/{x}', sync=True)
def double_value(x:int):
        return x*2

Running The Server

import asyncio
from asyncrest import serve

loop = asyncio.get_event_loop()