Lightweight REST Sever framework, based on bottle
Project description
AJAS
Description
Another JSON Api Server. This is a library for Python 3 to create fast JSON-Rest APIs.
Usage
A simple start:
from AJAS import Api
def simple_resolver(header, query):
return {"hello":"world"}
api = Api()
api.add_get_resolver("/hello", simple_resolver)
api.add_post_resolver("/hello", simple_resolver)
api.run("localhost", 8080)
This will run an webserver returning '{"hello":"world"}'
at the adress http://localhost:8080/hello
for both GET and POST requests.
Using blocks
Using blocks allows you to seperate different parts of your API. This can be used for versioning. Also, blocks can hold a authenticator, which can accept or deny a request based on the header and query of the reuest.
from AJAS import Api, Authenticator
class MyAuth(Authenticator):
def authenticate(self, header, query):
if someCheck() == True:
return True
else:
return False
def simple_resolver(header, query):
return {"hello":"world"}
api = Api()
v1 = Block("/v1")
v1.add_get_resolver("/hello", resolver)
api.add_block(v1)
api.run("localhost", 8080)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
AJAS-0.1.tar.gz
(3.2 kB
view details)
Built Distribution
AJAS-0.1-py3-none-any.whl
(4.4 kB
view details)
File details
Details for the file AJAS-0.1.tar.gz
.
File metadata
- Download URL: AJAS-0.1.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c02882cc4cc8d326ef18d987db66bb793fd4aa7532523e2905610ad78bd1fcf0 |
|
MD5 | ed5473621369d0cdf0076b723ac1825d |
|
BLAKE2b-256 | 596cbc01d0139ad8e5238a49f66e2e76a0f6aaeb96be1363a58281fe114b3544 |
File details
Details for the file AJAS-0.1-py3-none-any.whl
.
File metadata
- Download URL: AJAS-0.1-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1da5de5382a00ff3551b4d182a39eb9e30d3bdb8f06c09c8f17aa51d8e8f1642 |
|
MD5 | 3a8070b280f015621042cd945a8ddcdb |
|
BLAKE2b-256 | d879e705c4aab6ad0589286e4c154b7e74e83ed0d834b61126ef316d89007942 |