Skip to main content
######################
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/>`_


Release files for tornadoapi 1.0.1

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

Source distribution (sdist)

Source distribution for tornadoapi 1.0.1
File Size Uploaded
tornadoapi-1.0.1.tar.gz 21.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tornadoapi 1.0.1
File Interpreter ABI Platform
tornadoapi-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 48.8 kB

Release files / tornadoapi-1.0.1.tar.gz

Download URL tornadoapi-1.0.1.tar.gz
Size 21.7 kB
Tags Source
SHA-256 checksum
How to use checksums
cf2decb05b9bef2c7bb864e080406e859d4384eb31c17452cfac1844e4a2eeda
BLAKE2b-256 checksum
How to use checksums
fd9167249889e2c257dca83f8f5741b8fe1ab4506f1ff8e630883794b09c0c3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/38.2.4 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.3

Release files / tornadoapi-1.0.1-py3-none-any.whl

Download URL tornadoapi-1.0.1-py3-none-any.whl
Size 27.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0213d609d1c0c6348d61117be9bf7c9cd4927e51ac818027fa0d69dce253a9fc
BLAKE2b-256 checksum
How to use checksums
0cafb20432090897cd6342518fc44486fa2d01751afc1b4c7561420dffc5bddf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/38.2.4 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.3

Release history Release notifications | RSS feed

1.1.7

1 release file

1.1.6

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.2

2 release files

This release

1.0.1 This release

2 release files

1.0.0

2 release files

0.0.0

1 release file

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