Skip to main content

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 文件。

捐赠

如果小伙伴们觉得这些工具还不错的话,能否请咱喝一杯咖啡呢?

Pay-Total

联系方式

微信: yuyangiit
邮箱: yuyangit.0515@qq.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xy_request_handler_api-1.0.0.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

xy_request_handler_api-1.0.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file xy_request_handler_api-1.0.0.tar.gz.

File metadata

File hashes

Hashes for xy_request_handler_api-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f5196f7c44c7becfb11a269ab3e9169fc4eceb1aecdbc77b15228e00a4da3205
MD5 3c9b27ca0a5c8b1d55ff6b6434f95d9b
BLAKE2b-256 f80f1a7045e2459f0d3a209abffab708185c842530e2540156f7f495f4980996

See more details on using hashes here.

File details

Details for the file xy_request_handler_api-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for xy_request_handler_api-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8b3dd6a9447f3819e09437266d643d0aeac42119ea730905ad35c74fb4d0ca3b
MD5 7f5fc0893f211506958aeae908f8da64
BLAKE2b-256 07cfc47c99cc9a97043d1c25f069daf871cdebbaa0c01e032ba45a80e3dd2cc8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page