Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aiohttp-things

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aiohttp-things

Modest utility collection for development with AIOHTTP framework.

  • 1.1.0
  • PyPI
  • Socket score

Maintainers
1

============== aiohttp-things

|ReadTheDocs| |PyPI release| |License| |Python versions| |PyPI downloads| |GitHub CI|

.. |ReadTheDocs| image:: https://readthedocs.org/projects/aiohttp-things/badge/?version=latest :target: https://aiohttp-things.readthedocs.io/en/latest/?badge=latest :alt: Read The Docs build

.. |PyPI release| image:: https://badge.fury.io/py/aiohttp-things.svg :target: https://pypi.org/project/aiohttp-things/ :alt: Release

.. |License| image:: https://img.shields.io/badge/License-MIT-green :target: https://github.com/ri-gilfanov/aiohttp-things/blob/master/LICENSE :alt: MIT License

.. |Python versions| image:: https://img.shields.io/badge/Python-3.9%20%7C%203.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-blue :target: https://pypi.org/project/aiohttp-things/ :alt: Python version support

.. |PyPI downloads| image:: https://static.pepy.tech/personalized-badge/aiohttp-things?period=total&units=international_system&left_color=grey&right_color=blue&left_text=Downloads :target: https://pepy.tech/project/aiohttp-things :alt: PyPI downloads count

.. |GitHub CI| image:: https://github.com/ri-gilfanov/aiohttp-things/actions/workflows/ci.yml/badge.svg?branch=master :target: https://github.com/ri-gilfanov/aiohttp-things/actions/workflows/ci.yml :alt: GitHub continuous integration

Modest utility collection for development with AIOHTTP <https://docs.aiohttp.org/>_ framework.

Documentation

https://aiohttp-things.readthedocs.io

Installation

Installing aiohttp-things with pip: ::

pip install aiohttp-things

Simple example

Example of AIOHTTP application ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: python

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 = '[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}' ROUTES = [ web.view('/integer/{pk:[0-9]+}', IntegerExample), web.view(f'/uuid/{{pk:{UUID}}}', UUIDExample), ]

async def app_factory(): app = web.Application() app.add_routes(ROUTES) return app

if name == 'main': web.run_app(app_factory())

Examples HTTP requests and response ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Keywords

FAQs


Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc