chisel-1.2.2
1.2.2
1.2.1
1.2.0
1.1.9
1.1.8
1.1.7
1.1.6
1.1.5
1.1.4
1.1.3
1.1.2
1.1.14
1.1.13
1.1.12
1.1.11
1.1.10
1.1.1
1.1.0
1.0.7
1.0.6
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
0.9.99
0.9.98
0.9.97
0.9.96
0.9.95
0.9.94
0.9.93
0.9.92
0.9.91
0.9.90
0.9.89
0.9.88
0.9.87
0.9.86
0.9.85
0.9.84
0.9.83
0.9.82
0.9.81
0.9.80
0.9.79
0.9.78
0.9.77
0.9.76
0.9.70
0.9.69
0.9.68
0.9.67
0.9.66
0.9.65
0.9.64
0.9.63
0.9.62
0.9.61
0.9.60
0.9.51
0.9.50
0.9.49
0.9.48
0.9.47
0.9.46
0.9.45
0.9.44
0.9.43
0.9.42
0.9.41
0.9.40
0.9.39
0.9.38
0.9.37
0.9.36
0.9.35
0.9.34
0.9.33
0.9.32
0.9.31
0.9.30
0.9.29
0.9.28
0.9.27
0.9.26
0.9.25
0.9.24
0.9.23
0.9.22
0.9.21
0.9.20
0.9.19
0.9.18
0.9.17
0.9.16
0.9.15
0.9.14
0.9.13
0.9.129
0.9.128
0.9.127
0.9.126
0.9.125
0.9.124
0.9.123
0.9.122
0.9.121
0.9.120
0.9.119
0.9.118
0.9.117
0.9.116
0.9.115
0.9.114
0.9.113
0.9.112
0.9.111
0.9.110
0.9.109
0.9.108
0.9.107
0.9.106
0.9.105
0.9.104
0.9.103
0.9.102
0.9.101
0.9.100
0.8.31
0.8.29
0.8.28
توضیحات
Lightweight WSGI application framework, schema-validated JSON APIs, and API documentation
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | chisel-1.2.2 |
| نام | chisel |
| نسخه کتابخانه | 1.2.2 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Craig A. Hobbs |
| ایمیل نویسنده | craigahobbs@gmail.com |
| آدرس صفحه اصلی | https://github.com/craigahobbs/chisel |
| آدرس اینترنتی | https://pypi.org/project/chisel/ |
| مجوز | MIT |
chisel
======
.. |badge-status| image:: https://img.shields.io/pypi/status/chisel
:alt: PyPI - Status
:target: https://pypi.python.org/pypi/chisel/
.. |badge-version| image:: https://img.shields.io/pypi/v/chisel
:alt: PyPI
:target: https://pypi.python.org/pypi/chisel/
.. |badge-license| image:: https://img.shields.io/github/license/craigahobbs/chisel
:alt: GitHub
:target: https://github.com/craigahobbs/chisel/blob/main/LICENSE
.. |badge-python| image:: https://img.shields.io/pypi/pyversions/chisel
:alt: PyPI - Python Version
:target: https://www.python.org/downloads/
|badge-status| |badge-version| |badge-license| |badge-python|
Chisel is a light-weight Python WSGI application framework built for creating well-documented,
schema-validated JSON web APIs.
Links
-----
- `API Documentation <https://craigahobbs.github.io/chisel/>`__
- `Source code <https://github.com/craigahobbs/chisel>`__
JSON APIs
---------
Chisel provides the `action <https://craigahobbs.github.io/chisel/action.html#chisel.action>`__
decorator for easily implementing schema-validated JSON APIs.
>>> @chisel.action(spec='''
... # Sum a list of numbers
... action sum_numbers
... urls
... GET
...
... query
... # The list of numbers
... float[len > 0] numbers
...
... output
... # The sum of the numbers
... float sum
... ''')
... def sum_numbers(ctx, req):
... return {'sum': sum(req['numbers'])}
...
>>> application = chisel.Application()
>>> application.add_request(sum_numbers)
>>> application.request('GET', '/sum_numbers', query_string='numbers.0=1&numbers.1=2&numbers.2=4')
('200 OK', [('Content-Type', 'application/json')], b'{"sum":7.0}')
Each action defines an ``action`` definition using
`Schema Markdown <https://craigahobbs.github.io/schema-markdown-js/language/>`__.
The action callback is passed two arguments, a request
`Context <https://craigahobbs.github.io/chisel/app.html#chisel.Context>`__
and the schema-validated request input dictionary. The input request dictionary is created by
combining the request's URL path parameters, query string parameters, and input JSON content
parameters.
If there is a schema validation error the appropriate error code is automatically returned.
>>> status, _, content_bytes = application.request('GET', '/sum_numbers')
>>> status
'400 Bad Request'
>>> content_bytes
b'{"error":"InvalidInput","message":"Required member \'numbers\' missing (query string)"}'
API Documentation
-----------------
You can add API documentation to your application by adding the Chisel documentation application
requests from
`create_doc_requests <https://craigahobbs.github.io/chisel/request.html#chisel.create_doc_requests>`__.
>>> application = chisel.Application()
>>> application.add_requests(chisel.create_doc_requests())
By default the documentation application is hosted at "/doc/". An example of of Chisel's documentation output is
available `here <https://craigahobbs.github.io/chisel/example/#var.vName='chisel_doc_request'>`__.
Development
-----------
This project is developed using `python-build <https://github.com/craigahobbs/python-build#readme>`__. It was started
using `python-template <https://github.com/craigahobbs/python-template#readme>`__ as follows::
template-specialize python-template/template/ chisel/ -k package chisel -k name 'Craig A. Hobbs' -k email 'craigahobbs@gmail.com' -k github 'craigahobbs' -k nomain 1
نیازمندی
| مقدار | نام |
|---|---|
| >=1.2.0 | schema-markdown |
نحوه نصب
نصب پکیج whl chisel-1.2.2:
pip install chisel-1.2.2.whl
نصب پکیج tar.gz chisel-1.2.2:
pip install chisel-1.2.2.tar.gz