Skip to main content

Uniform - dress your form processing endpoints📋

Project description

uniform

Uniform

📋 Dress your form processing endpoints. 📋


Pipeline Status Coverage Report PyPI: uniform Code Style: Black


Introduction

Uniform is a form processing tool that can be easily plugged into your Starlette backend.

It gives you the following:

  • Extract and validate form data against typesystem.Schema
  • Return 400 Bad Request with validation problems explained
  • 100% test coverage.
  • 100% type annotated codebase.

Requirements

Python 3.6+

Installation

$ pip3 install uniform

Example

example.py:

import uvicorn

from starlette.applications import Starlette
from starlette.requests import Request
from starlette.responses import PlainTextResponse
from typesystem import Schema, Boolean

from uniform import Uniform, validate

app = Starlette()


class TestSchema(Schema):
    test = Boolean()


@app.route("/")
@validate(Uniform(TestSchema))
async def home(request: Request) -> PlainTextResponse:
    return JSONResponse(
        content={"ok": True, "description": None, "result": dict(request.state.data)}
    )


if __name__ == "__main__":
    uvicorn.run(app, host="0.0.0.0", port=8080)

Then run the application...

$ python example.py

Send POST request to http://127.0.0.1:8080/ with application/json or application/x-www-form-urlencoded data and it will be validated.

Dependencies

Uniform work with starlette endpoints and validate forms using typesystem library.

If you want to parse application/x-www-form-urlencoded form data - you will also need a python-multipart.

— 📋 —

Uniform is Unlicensed code in Public Domain.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uniform-0.2.2.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

uniform-0.2.2-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file uniform-0.2.2.tar.gz.

File metadata

  • Download URL: uniform-0.2.2.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.9

File hashes

Hashes for uniform-0.2.2.tar.gz
Algorithm Hash digest
SHA256 b0480c77cf476e255d026dce02c802b4d957b77f512f4b0482a3eace447d93b1
MD5 4f0ef60c21482cd949da422f18ed3a5f
BLAKE2b-256 91c4fb45b22ca335a28345b429a5a099f706a6180a9dff40e9109fed54e87329

See more details on using hashes here.

File details

Details for the file uniform-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: uniform-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.9

File hashes

Hashes for uniform-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ed4358bebc3ed2a7fbccbfaa881599aca974ff7a5b7a42ea4727c01b4d80ac5b
MD5 ac0b154e478c77da043c2b955e563e54
BLAKE2b-256 5c59a3f0642ba23631058b4f8fafd165cb77f67df36aa79dd50d39e7aede710b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page