Tornado REST framework
Project description
######################
Tornado REST framework
######################
.. image:: https://travis-ci.org/007gzs/tornado-rest-framework.svg?branch=master
:target: https://travis-ci.org/007gzs/tornado-rest-framework
.. image:: https://img.shields.io/pypi/v/tornadoapi.svg
:target: https://pypi.org/project/tornadoapi
Tornado REST framework
`【阅读文档】 <http://tornadoapi.readthedocs.io/zh_CN/latest/>`_。
安装
---------------------
目前 tornadoapi 支持的 Python 环境有 2.7, 3.4, 3.5, 3.6 和 pypy。::
pip install tornadoapi
快速开始
_____________________
启动之前或启动脚本开始时配置环境变量::
os.environ.setdefault("TORNADOAPI_SETTINGS_MODULE", "config.settings")
config/settings.py 中增加自定义配置::
DEBUG = True
TEST = 1
通过以下代码可以获取到settings参数::
from tornadoapi.conf import settings
settings.TEST
ApiHandler调用示例::
from tornadoapi.handler import ApiHandler
class TestHandler(ApiHandler):
test_param = fields.CharField(description='测试参数', default=None)
test_choice = fields.ChoiceField(description='选择参数', default=None, choices=((0, '选项0'), (1, '选项1')))
@classmethod
def get_return_sample(cls):
return ErrCode.SUCCESS.get_res_dict(data={'test_param': '测试参数', 'test_choice' :'选择参数'})
@classmethod
def get_handler_name(cls):
return '测试'
def get(self, *args, **kwargs):
ret = {
'test_param': self.test_param,
'test_choice': self.test_choice
}
self.write_api(ret)
示例项目
---------------------
`demo <https://github.com/007gzs/tornadoapi-example/>`_
Tornado REST framework
######################
.. image:: https://travis-ci.org/007gzs/tornado-rest-framework.svg?branch=master
:target: https://travis-ci.org/007gzs/tornado-rest-framework
.. image:: https://img.shields.io/pypi/v/tornadoapi.svg
:target: https://pypi.org/project/tornadoapi
Tornado REST framework
`【阅读文档】 <http://tornadoapi.readthedocs.io/zh_CN/latest/>`_。
安装
---------------------
目前 tornadoapi 支持的 Python 环境有 2.7, 3.4, 3.5, 3.6 和 pypy。::
pip install tornadoapi
快速开始
_____________________
启动之前或启动脚本开始时配置环境变量::
os.environ.setdefault("TORNADOAPI_SETTINGS_MODULE", "config.settings")
config/settings.py 中增加自定义配置::
DEBUG = True
TEST = 1
通过以下代码可以获取到settings参数::
from tornadoapi.conf import settings
settings.TEST
ApiHandler调用示例::
from tornadoapi.handler import ApiHandler
class TestHandler(ApiHandler):
test_param = fields.CharField(description='测试参数', default=None)
test_choice = fields.ChoiceField(description='选择参数', default=None, choices=((0, '选项0'), (1, '选项1')))
@classmethod
def get_return_sample(cls):
return ErrCode.SUCCESS.get_res_dict(data={'test_param': '测试参数', 'test_choice' :'选择参数'})
@classmethod
def get_handler_name(cls):
return '测试'
def get(self, *args, **kwargs):
ret = {
'test_param': self.test_param,
'test_choice': self.test_choice
}
self.write_api(ret)
示例项目
---------------------
`demo <https://github.com/007gzs/tornadoapi-example/>`_
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file tornadorestframework-1.0.2.tar.gz
.
File metadata
- Download URL: tornadorestframework-1.0.2.tar.gz
- Upload date:
- Size: 25.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 004a04671dc9750e3124afb8ded54633312b6a2a26107e3bcb48fdbfb66c9360 |
|
MD5 | a6d37c881fdcfc3a1643f98ad3bbe5a0 |
|
BLAKE2b-256 | ac610ebdacd6c3e64671d223f10c58a1dd76a18d68c47bd703d27fdf71962504 |
File details
Details for the file tornadorestframework-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: tornadorestframework-1.0.2-py3-none-any.whl
- Upload date:
- Size: 29.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | effb662e3c4ad4800a51877b5b022f21de0d0c2d268dc1a9592526d8987da982 |
|
MD5 | 1e65c1c83e9dc4ca74066d1c1f793c32 |
|
BLAKE2b-256 | e06826d175107820aea1f0b8a377f1f32929532eedd45663559ef9329fbad59c |