Package designed to generate REST API layer
Project description
REST-API-GENERATOR
REST-API-GENERATOR is a python tool that helps reduce the time it takes to create dummy REST endpoints during the initial stages of your project.
Installation
pip install REST-API-Generator
Supported Frameworks
- Sanic
How to use it
To use REST-API-GENERATOR package to create dummy REST endpoints you have to provide a python dict
as an input. This python dict
shall contain all the necessary information of the REST endpoints that you want to build.
Take a look at the sample input json file below
{
"project_dir": "~/project_dir",
"project_name": "Test_project",
"api_module_name" : "webapp"
"framework_object": "app",
"framekwork": "sanic",
"host": "0.0.0.0",
"port": "1201",
"api_list": [
{
"method_handler_name": "get_name",
"HTTP_method": "GET",
"path": "/name",
"response": [
"name1",
"name2"
]
},
{
"method_handler_name": "add_name",
"HTTP_method": "POST",
"path": "/add_name",
"response": "new_name"
},
{
"method_handler_name": "update_name",
"HTTP_method": "PUT",
"path": "/update_name",
"response": "name3"
}
]
}
project_dir : root directory path of the project (required)
project_name : name of the project (required)
api_module_name : name of the API module --default : 'webapp'
framework_object : name of the framework object --default : 'app'
framekwork : name of the framework in which the project is created (required)
host : host address of the server (required)
port : port address of the server (required)
api_list : list of all the individual end points
method_handler_name : name of a method handler of a particular end-point (required)
HTTP_method : HTTP method type (required)
path : url path (required)
response : sample response (required)
Use the following python script to generate dummy end-points
- Sanic framework
from API_Gen import SanicGenerator
import json
if __name__ == '__main__':
with open('input.json') as file:
api_info = json.load(file)
sp = SanicGenerator(api_info=api_info)
# 1. Use create_apis() to generate a new API layer
sp.create_apis()
# 2. Use add_apis() to add new endpoints to exixting API layer
sp.create_apis()
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
Built Distribution
File details
Details for the file REST_API_Generator-1.0.1.tar.gz
.
File metadata
- Download URL: REST_API_Generator-1.0.1.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70493519a49b3dd84965eb5902c13c258c310b8d55cfee06e4367f1b8ac29ad9 |
|
MD5 | dee383a3f530c1968ce8d4077826602c |
|
BLAKE2b-256 | eeee32f7d893996e7564037d3ac5fd5603d7eeb98cad255545f548e31aa4285b |
File details
Details for the file REST_API_Generator-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: REST_API_Generator-1.0.1-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a77b9e4b38e19e3764ae4f62c33a76f28ff015212378e930b2d9a42bc8b8126 |
|
MD5 | 598e10759d1e823e0570a11d20dbd876 |
|
BLAKE2b-256 | 3675992d4ceaf38ce60ee32ccd0739d190578694d2901683438a3c11c9b2d784 |