Pre-release
This release is a pre-release and may not be stable for production use.
Lite Framework, Easy Coding, High Performance, No Dependencies, Tested for Production
Features
- Lite with no dependencies
- The framework built using standard python libraries and does not need third party pre-requisites.
- Easy Code
- The framework designed to allow different levels of skillsets to use the code and learn it fast.
- Supported
- Our team is committed to review, test and resolve any issues related to the framework interactively. Please don’t hesitate to submit your problem in github’s issue section.
Requirements
Python 3.6+
Installation
pip install liteapi
Usage
from liteapi import liteapi,BaseAPIRequest
app = liteapi()
@app.register('/')
class rootMethod (BaseAPIRequest):
def get(self):
return {'message': 'Thank you for using liteapi'}
app.run()
- Import the framework using
from liteapi import liteapi,BaseAPIRequest
- Create an app instance of liteapi
app = liteapi()
- Note: to change the socket binding you can pass the host and port arguments to liteapi as below
app = liteapi(host='0.0.0.0', port=8080)
- Register class for each URI (The class has to be subclass from BaseAPIRequest)
@app.register('/')
class rootMethod (BaseAPIRequest):
- Inside your class, define your methods of get, delete, post, put
def get(self):
return {'message': 'Welcome to liteapi'}
- Run your instance
app.run()
Example
The below example shows different method use cases for liteapi:
@app.register('/{tenant:str}')
class tenantMethod (BaseAPIRequest):
def get(self, tenant):
return {'message': 'Hello', 'tenant': tenant, 'query': self.request.query_string}
def put(self, tenant):
return {'method': 'Put', 'tenant': tenant, 'json': self.request.json}
def post(self, tenant):
return {'method': 'Post', 'tenant': tenant, 'json': self.request.json}
def delete(self, tenant):
return {'method': 'Delete', 'tenant': tenant, 'json': self.request.json}
License
This project is licensed under the terms of GPL-3.0 license.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
liteapi-0.4.2a0.tar.gz
(26.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
liteapi-0.4.2a0-py3-none-any.whl
(30.7 kB
view details)
File details
Details for the file liteapi-0.4.2a0.tar.gz.
File metadata
- Download URL: liteapi-0.4.2a0.tar.gz
- Upload date:
- Size: 26.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/4.0.1 CPython/3.7.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8887171464af6fd96640847ae9be62ebecf266afa11231c9afbc81fbafbf02eb
|
|
| MD5 |
567930f86bc0078817c2d2b6ffb68db7
|
|
| BLAKE2b-256 |
117712e73ef15fd6cc74ae15de2958a25576f7145ce35a7a9945733c58328ae9
|
File details
Details for the file liteapi-0.4.2a0-py3-none-any.whl.
File metadata
- Download URL: liteapi-0.4.2a0-py3-none-any.whl
- Upload date:
- Size: 30.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/4.0.1 CPython/3.7.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70ef695358368ab9e137f36aea8079cf2e6f3d7d42930f25cc6ca2daf50d8645
|
|
| MD5 |
43f12a31ed9c47197ddf8dd7af6e2fc2
|
|
| BLAKE2b-256 |
f8b1f74c14432222401b7d7b529f66426271fe8a5ba913d25a8d8087499a37ff
|