Skip to main content

install

pip install -U git+https://github.com/sazima/tornado_request_mapping

A simple example

import tornado.ioloop
from tornado.websocket import WebSocketHandler
import tornado.web
from tornado_request_mapping import request_mapping, Route


@request_mapping("/test")
class MainHandler(tornado.web.RequestHandler):
    @request_mapping('/get_by_id', method='get')
    async def test(self):
        self.write("Hello, world. get")

    @request_mapping('/update_by_id', method='post')
    async def test1(self):
        self.write("Hello, world. post")


@request_mapping('/t')
class MyHandler(tornado.web.RequestHandler):
    @request_mapping('/get_by_id', method='put')
    async def test(self):
        self.write("Hello, world. put")


@request_mapping("/ws")
class Wshandler(WebSocketHandler):
    def open(self, *args: str, **kwargs: str):
        print('open')

    def close(self, code: int = None, reason: str = None) -> None:
        print('close')

    def check_origin(self, origin: str) -> bool:
        return True


if __name__ == "__main__":
    app = tornado.web.Application()

    route = Route(app)
    route.register(MainHandler)
    route.register(MyHandler)
    route.register(Wshandler)

    app.listen(8888)
    tornado.ioloop.IOLoop.current().start()

Metadata

Release files for tornado-request-mapping 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for tornado-request-mapping 0.0.6
File Interpreter ABI Platform
tornado_request_mapping-0.0.6-py3-none-any.whl Python 3 none any Details

Release files / tornado_request_mapping-0.0.6-py3-none-any.whl

Download URL tornado_request_mapping-0.0.6-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
10ea8f14f6f8a8d01b57b5c7ab7d88ce4998eff7fcf67fc0d63d56b2ceec2c3b
BLAKE2b-256 checksum
How to use checksums
9d8cbeec79231ff98bf6557ac25f114df9e87faedd3f0dfa6bd4bdc11a622559
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.26.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.6.12

Release history Release notifications | RSS feed

This release

0.0.6 This release

1 release file

0.0.5

3 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page