AJAS-0.2.3
توضیحات
Lightweight REST Sever framework, based on bottle
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | AJAS-0.2.3 |
| نام | AJAS |
| نسخه کتابخانه | 0.2.3 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Christian Schweigel |
| ایمیل نویسنده | - |
| آدرس صفحه اصلی | https://github.com/swip3798/AJAS |
| آدرس اینترنتی | https://pypi.org/project/AJAS/ |
| مجوز | - |
# AJAS
[](https://travis-ci.org/swip3798/AJAS)
[](https://www.gnu.org/licenses/lgpl-3.0)
[]()
## Description
Another JSON Api Server. This is a library for Python 3 to create fast JSON-Rest APIs. It uses flask and gevent in the background.
## Usage
A simple start:
```python
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.
```python
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)
```
نیازمندی
| مقدار | نام |
|---|---|
| ==0.12.16 | bottle |
| ==1.4.0 | gevent |
| ==1.0.3 | Flask |
نحوه نصب
نصب پکیج whl AJAS-0.2.3:
pip install AJAS-0.2.3.whl
نصب پکیج tar.gz AJAS-0.2.3:
pip install AJAS-0.2.3.tar.gz