xy_request_handler_api
| 简体中文 | 繁體中文 | English |
|---|
说明
基于xy_request_handler_base的api请求基类,封装了常用功能,方便快速开发.
源码仓库
| Github | Gitee | GitCode |
|---|
安装
# bash
pip install xy_request_handler_api
使用
详情请查看 Demoes.py
# Demoes.py
from xy_request_handler_api.Api import Api
class Demo(Api):
def check_xsrf_cookie(self) -> None:
return None
def check_origin(self, _):
return False
def post(self):
json_arguments = self.json_arguments
self.success()
self.data = {
"resp_data_json": json_arguments,
}
self.xy_response()
运行 样例工程
样例工程具体使用方式请移步 xy_web_server.git 下列仓库
| Github | Gitee | GitCode |
|---|
# bash
# 当前目录为xy_request_handler_api的git本地仓库所在目录
# 切换到工程目录
cd ./samples/xy_web_server_demo
# 启动样例工程的Tornado服务
xy_web_server -w tornado start
# 默认启动的Tornado服务url地址是: http://127.0.0.1:8400
# 浏览器打开访问 http://127.0.0.1:8400/demo 进行验证
2. 检验接口请求
# Python解释器
# 以下是示例代码,需要在您的应用中实现
# 用来进行测试接口请求
# Python解释器运行以下代码
import requests
post_json_data = {"test":"post json data text"}
url = "http://127.0.0.1:8400/demo"
resp = requests.post(url, json=post_json_data)
resp_json = resp.json()
{'code': 0,
'message': '请求成功',
'data': {'resp_data_json': {'test': 'post json data text'}}}
许可证
xy_request_handler_api 根据 <木兰宽松许可证, 第2版> 获得许可。有关详细信息,请参阅 LICENSE 文件。
捐赠
如果小伙伴们觉得这些工具还不错的话,能否请咱喝一杯咖啡呢?
联系方式
微信: yuyangiit
邮箱: yuyangit.0515@qq.com
Release files for xy-request-handler-api 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| xy_request_handler_api-1.0.0.tar.gz | 7.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| xy_request_handler_api-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.1 kB
Release files / xy_request_handler_api-1.0.0.tar.gz
| Download URL | xy_request_handler_api-1.0.0.tar.gz |
|---|---|
| Size | 7.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f5196f7c44c7becfb11a269ab3e9169fc4eceb1aecdbc77b15228e00a4da3205
|
|
BLAKE2b-256 checksum How to use checksums |
f80f1a7045e2459f0d3a209abffab708185c842530e2540156f7f495f4980996
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.3
|
Release files / xy_request_handler_api-1.0.0-py3-none-any.whl
| Download URL | xy_request_handler_api-1.0.0-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8b3dd6a9447f3819e09437266d643d0aeac42119ea730905ad35c74fb4d0ca3b
|
|
BLAKE2b-256 checksum How to use checksums |
07cfc47c99cc9a97043d1c25f069daf871cdebbaa0c01e032ba45a80e3dd2cc8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.3
|