python-yapi
Python Client for YApi based on HTTP Api.
Install
pip install python-yapi
Simple Use
Register and Login
from python_yapi import YApi
yapi = YApi(base_url='http://localhost:3000')
username, email, password = 'Kevin', 'kevin@126.com', 'abc123'
yapi.register(username, email, password) # return a dict
yapi.login( email, password) # return a dict
Simple Use
import json
from python_yapi import YApi
yapi = YApi(base_url='http://localhost:3000')
email, password = 'kevin@126.com', 'abc123'
yapi.login(email, password)
# Create a private project in user default group, with auto basepath, random color and random icon.
project = yapi.add_project('Demo Project')
project_id = project['_id']
# Create a private "GET" interface in project default category with a sample json response.
yapi.add_interface(project_id=project_id,
title='Calc Add',
method='GET',
path='/add',
req_query=[
{"name": "a", "required": "1", "example": "1", "desc": "变量a"},
{"name": "b", "required": "1", "example": "2", "desc": "变量b"},
],
res_body_type="json",
res_body=json.dumps({"code": 0, "message": "success", "data": {"result": "3"}}),
res_body_is_json_schema=False,
status='done')
# Create a private "POST" interface in project default category with a sample json data and a sample json response.
yapi.add_interface(project_id=project_id,
title='Calc Sub',
method='POST',
path='/sub',
req_headers=[{"name": "Content-Type", "value": "application/json"}],
req_body_type="json",
req_body_other=json.dumps({"a": "5", "b": "1"}),
req_body_is_json_schema=False,
res_body_type="json",
res_body=json.dumps({"code": 0, "message": "success", "data": {"result": "4"}}),
res_body_is_json_schema=False,
status='done')
Metadata
Release files for python-yapi 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| python_yapi-0.1.3.tar.gz | 17.8 kB | Without provenance | Details for python_yapi-0.1.3.tar.gz |
Release files / python_yapi-0.1.3.tar.gz
| Download URL | python_yapi-0.1.3.tar.gz |
|---|---|
| Size | 17.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5c95b89ea9434c95b15a51b77adb59d6b4a34300eef848f56d362bbd5593df6c
|
|
BLAKE2b-256 checksum How to use checksums |
d08fd532bf02dc69a0c7171ecb700d9bac184874681d085e0f721e6aa1610c2b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.6
|
Security for python-yapi 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.