Api请求模块
Project description
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
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 xy_request_handler_api-1.0.0.tar.gz
.
File metadata
- Download URL: xy_request_handler_api-1.0.0.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5196f7c44c7becfb11a269ab3e9169fc4eceb1aecdbc77b15228e00a4da3205 |
|
MD5 | 3c9b27ca0a5c8b1d55ff6b6434f95d9b |
|
BLAKE2b-256 | f80f1a7045e2459f0d3a209abffab708185c842530e2540156f7f495f4980996 |
File details
Details for the file xy_request_handler_api-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: xy_request_handler_api-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b3dd6a9447f3819e09437266d643d0aeac42119ea730905ad35c74fb4d0ca3b |
|
MD5 | 7f5fc0893f211506958aeae908f8da64 |
|
BLAKE2b-256 | 07cfc47c99cc9a97043d1c25f069daf871cdebbaa0c01e032ba45a80e3dd2cc8 |