semvec/pypi-packages huggingface dataset:
sanic-utils 0.1.1
A suite of sanic sanic_utils
Requires Python: >=3.7

# sanic-utils

A suite of useful Sanic utilities

## from_json

A decorator for Sanic endpoints to grab the json from the request and pass it in as a parameter. 
Default Sanic approach:


```python
from sanic import Sanic, response
from sanic.request import Request

app = Sanic("App Name")

class ExampleInput:
    name: str
    identifier: str

@app.post("/test")
async def test(request: Request):
    json = request.json
    message = None # convert json to object in whatever prefered way
    return response.text("done")

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=8112)
```

Usage of the decorator:

```python
from dataclasses import dataclass

from dataclasses_json import dataclass_json
from sanic import Sanic, response
from sanic.request import Request

from sanic_utils.from_json import from_json

app = Sanic("App Name")

@dataclass_json
@dataclass
class ExampleInput:
    name: str
    identifier: str

@app.post("/test")
@from_json(message_type=ExampleInput)
async def test(request: Request, message: ExampleInput):
    print(message)
    return response.text("done")

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=8112)
```

###  Usage

Mark endpoint method with @from_json decorator passing in a single param, the resulting message type.
The message type should be marked with @dataclass_json and @dataclass.

## Dependencies

sanic 20.6.3

dataclasses 0.6

dataclasses-json 0.5.1

# [CONTRIBUTING](CONTRIBUTING.md)

# [LICENSE](LICENSE)
pydantic-collection 0.0.3
pydantic-collection is collections of pydantic model
Requires Python: >=3.8.0

# pydantic-collection - Collections of pydantic model

[![Test Status](https://github.com/koxudaxi/pydantic-collection/workflows/Test/badge.svg)](https://github.com/koxudaxi/pydantic-collection/actions)
[![PyPI version](https://badge.fury.io/py/pydantic_collection.svg)](https://badge.fury.io/py/pydantic_collection)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pydantic_collection)](https://pypi.python.org/pypi/pydantic_collection)
[![codecov](https://codecov.io/gh/koxudaxi/pydantic-collection/branch/master/graph/badge.svg)](https://codecov.io/gh/koxudaxi/pydantic-collection)
![license](https://img.shields.io/github/license/koxudaxi/pydantic-collection.svg)

pydantic-collection is collections of pydantic model

## Models

## This project is an experimental phase.
Warning: Some interface will be changed.

## How to install
pydantic-collection requires Python 3.8.0 or later 
```bash
$ pip install pydantic-collection
```

## Contributing to pydantic-collection
We are waiting for your contributions to `pydantic-collection`.

### How to contribute
[https://koxudaxi.github.io/pydantic-collection/contributing](https://koxudaxi.github.io/pydantic-collection/contributing)


## PyPi 

[https://pypi.org/project/pydantic-collection](https://pypi.org/project/pydantic_collection)

## Source Code

[https://github.com/koxudaxi/pydantic-collection](https://github.com/koxudaxi/pydantic-collection)

## Documentation

[https://koxudaxi.github.io/pydantic-collection](https://koxudaxi.github.io/pydantic-collection)

## License

pydantic-collection is released under the MIT License. http://www.opensource.org/licenses/mit-license