
Security News
NVD Concedes Inability to Keep Pace with Surging CVE Disclosures in 2025
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
|version| |pipeline status| |coverage report|
.. |pipeline status| image:: https://gitlab.com/nonamenix/aiohug/badges/master/pipeline.svg :target: https://gitlab.com/nonamenix/aiohug/commits/master .. |coverage report| image:: https://gitlab.com/nonamenix/aiohug/badges/master/coverage.svg :target: https://gitlab.com/nonamenix/aiohug/commits/master .. |version| image:: https://badge.fury.io/py/aiohug.svg :target: https://badge.fury.io/py/aiohug
Meet the aiohug
_.. _Meet the aiohug
: https://github.com/nonamenix/notes/blob/master/notes/20190309_aiohug.md
.. code:: python
from aiohttp import web from aiohug import RouteTableDef
routes = RouteTableDef()
@routes.get("/hello/{name}/") async def hello(name: fields.String(), greeting: fields.String() = "Hello"): return {"msg": f"{greeting}, {name}"}
app = web.Application() app.add_routes(routes)
if name == "main": web.run_app(app)
There is no request
object in handler signature anymore - only required arguments.
.. code:: python
from aiohttp import web from aiohug import RouteTableDef
routes = RouteTableDef()
class PayloadSchema(Schema): count = fields.Int()
@routes.get("/") async def with_body(body: PayloadSchema()): return body
app = create_app() app.add_routes(routes)
client = await test_client(app) resp = await client.get("/", json={"count": "5", "another": 7})
assert await resp.json() == {"count": 5}
.. code:: python
@routes.post("/ping/") async def ping(): return 201, "pong"
Use aiohug_swagger_ package.
.. _aiohug_swagger: https://github.com/nonamenix/aiohug_swagger
Because of the way aiohttp
routing works all decorators to resource handlers
must be applied BEFORE aiohug
's routing decorator, i.e.
.. code:: python
def some_decorator(func):
@wraps(func)
def wrapper(request, *args, **kwargs):
# Some logic for decorator
return func(*args, **kwargs)
return wrapper
@routes.get("/ping/")
@some_decorator
async def hello():
return "pong"
Moreover, make sure to decorate wrapper functions with wraps
decorator from functools
module
aiohug
won't be able to access original handler's arguments and annotations.It's just hug_ API implementation for aiohttp
.. _hug: https://github.com/timothycrosley/hug
FAQs
aiohug
We found that aiohug demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
Security Fundamentals
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.
Security News
Join Socket for exclusive networking events, rooftop gatherings, and one-on-one meetings during BSidesSF and RSA 2025 in San Francisco.