Skip to main content

EZTea Web Framework

Project description

EZTea Web Framework

# use falcon
pip install eztea[falcon,mysql,migration,testing]

# use django
pip install eztea[django,postgresql,testing]

Usage

Falcon Example

from validr import T

from eztea.falcon import Application, ResponderContext, Router

router = Router()


@router.get("/")
def hello(
    ctx: ResponderContext,
    name: str = T.str.default("world"),
) -> T.dict(hello=T.str):
    return {"hello": name}


app = Application()
app.include_router(router)

Django Example

from validr import T

from django.http import HttpRequest
from eztea.django import Router

router = Router()


@router.get("/")
def hello(
    req: HttpRequest,
    name: str = T.str.default("world"),
) -> T.dict(hello=T.str):
    return {"hello": name}


urls = router.to_url_s()

Testing Example

from eztea.falcon.testing import WebTestClient
from eztea.django.testing import WebTestClient
from myapp.wsgi import application

def test_hello():
    client = WebTestClient(application)
    response = client.get('/')
    assert response.status_code == 200
    assert reesponse.json() == {"hello": "world"}

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

eztea-0.1.10.tar.gz (20.3 kB view hashes)

Uploaded source

Built Distribution

eztea-0.1.10-py3-none-any.whl (27.9 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page