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
- Flask
- 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": "framework name",
"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)
generator = SanicGenerator(api_info=api_info)
# 1. Use create_apis() to generate a new API layer
generator.create_apis()
# 2. Use add_apis() to add new endpoints to exixting API layer
generator.create_apis()
- Flask framework
from API_Gen import FlaskGenerator
import json
if __name__ == '__main__':
with open('input.json') as file:
api_info = json.load(file)
generator = FlaskGenerator(api_info=api_info)
# 1. Use create_apis() to generate a new API layer
generator.create_apis()
# 2. Use add_apis() to add new endpoints to exixting API layer
generator.create_apis()
Please note that the dummy response for flask framework shoud be either string or dict in input.json
Metadata
Release files for REST-API-Generator 1.1.1
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 |
|---|---|---|---|---|
| REST_API_Generator-1.1.1.tar.gz | 5.3 kB | Without provenance | Details for REST_API_Generator-1.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| REST_API_Generator-1.1.1-py3-none-any.whl | Python 3 | none | any | Details for REST_API_Generator-1.1.1-py3-none-any.whl |
Total release size: 12.4 kB
Release files / REST_API_Generator-1.1.1.tar.gz
| Download URL | REST_API_Generator-1.1.1.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e4d3a9681a9b6e8eca4c88277a61fd0681b5c361f93b80732efdb429d00fa640
|
|
BLAKE2b-256 checksum How to use checksums |
8347f2cb055daec192b59834defc0033b3a46d5416daf8eca3c4ab136706e998
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / REST_API_Generator-1.1.1-py3-none-any.whl
| Download URL | REST_API_Generator-1.1.1-py3-none-any.whl |
|---|---|
| Size | 7.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
52bbbc8fb6418b0e4c7eb404d54be9990b848fef762030d5d51bcedbaf65ce88
|
|
BLAKE2b-256 checksum How to use checksums |
01681633217a3c0c7c4d40345f46ca2296472305de8d0c46945a8571679fccfa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Security for REST-API-Generator 1.1.1
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.