classic-http-api-0.0.2
توضیحات
Provides wrapper around Falcon web framework, adding class-app-layer support
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | classic-http-api-0.0.2 |
| نام | classic-http-api |
| نسخه کتابخانه | 0.0.2 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Sergei Variasov |
| ایمیل نویسنده | variasov@gmail.com |
| آدرس صفحه اصلی | https://github.com/variasov/classic_http_api |
| آدرس اینترنتی | https://pypi.org/project/classic-http-api/ |
| مجوز | - |
# Classic HTTP Api
This package provides base for http APIs, based Falcon framework.
Part of project "Classic".
Usage:
```python
from classic.http_api import App
class Reports:
def on_get_for_day(self, request, response):
response.media = {'day': 'report'}
def on_get_for_month(self, request, response):
response.media = {'day': 'period'}
app = App()
# Will generate URLs:
# /api/reports/for_day
# /api/reports/for_month
app.register(Reports())
# If we need to customize url:
app.register(Reports(), url='/order_reports')
# Urls will be:
# /api/order_reports/for_day
# /api/order_reports/for_month
# We may register methods only:
app.add_method('/reports/daily', Reports(), suffix='for_day')
# Url will be /api/reports/daily
# prefix may be customized in App class:
app = App(prefix='/api/custom')
# Now, URL will be /api/custom/reports/daily
app.add_method('/reports/daily', Reports(), suffix='for_day')
```
Also, App class can transform pydantic.ValidationError, AppError and ErrorsList
from classic.app to formats:
ValidationError:
```json
[
{
"type": "namespace.error_code",
"msg": "Verbose message",
"loc": ["path", "to", "error"]
}
]
```
AppError:
```json
[
{
"type": "namespace.error_code",
"msg": "Verbose message",
"ctx": {"any_key": "any_useful_info"}
}
]
```
Also, this response statuses in this cases will be 400.
نیازمندی
| مقدار | نام |
|---|---|
| ~=3.0.1 | falcon |
| ~=1.8.2 | pydantic |
| ~=0.0.1 | classic-components |
| ~=0.0.1 | classic-app-layer |
| ~=6.2.5 | pytest |
| ~=2.12.1 | pytest-cov |
| ~=3.4.2 | twine |
| ~=0.7.0 | build |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.7 | Python |
نحوه نصب
نصب پکیج whl classic-http-api-0.0.2:
pip install classic-http-api-0.0.2.whl
نصب پکیج tar.gz classic-http-api-0.0.2:
pip install classic-http-api-0.0.2.tar.gz