Skip to main content

An api module generator.

Project description

apininja

apininja is a simple automation tool that generates a small boilerplate module that serves as api for database models or other models. Currently it generates the basic CRUD operations as well as functions for serializing a single object to dictionary.

Sample Output

A sample output for apininja MyModel

# API Created for my_model

def serialize_my_model(data):
	return {"id": data.id}

def serialize_my_models(lst):
	serialized = []
	for item in lst:
		serialized.append(serialize_my_model(item))
	return serialized

def my_model_list_api(lst):
	return serialize_my_models(lst)

def my_model_detail_api(data):
	return serialize_my_model(data)

def my_model_create_api(*args, **kwargs):
	pass

def my_model_update_api(*args, **kwargs):
	pass

def my_model_delete_api(*args):
	pass

Installation

pip install apininja

Usage

apininja UserModel

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

apininja-0.1.8.tar.gz (2.4 kB view hashes)

Uploaded Source

Built Distribution

apininja-0.1.8-py3-none-any.whl (2.6 kB view hashes)

Uploaded Python 3

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