Modest utility collection for development with AIOHTTP framework
aiohttp-things Modest utility collection for development with AIOHTTP framework. Installation Installing aiohttp-things with pip: pip install aiohttp-things Simple example Example of AIOHTTP application import json import uuid import aiohttp_things as ahth from aiohttp import web def safe_json_value(value): try: json.dumps(value) return value except (TypeError, OverflowError): return str(value) class Base(web.View, ahth.JSONMixin, ahth.PrimaryKeyMixin): async def get(self): self.context[‘Type of primary key’] = safe_json_value(type(self.pk)) self.context[‘Value of primary key’] = safe_json_value(self.pk) return await self.finalize_response() class IntegerExample(Base): pk_adapter = int class UUIDExample(Base): pk_adapter = uuid.UUID UUID = […]
Read more