Skip to main content

Lightweight REST Sever framework, based on bottle

Project description

AJAS

Build Status License: LGPL v3 Generic badge

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:

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


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.2.tar.gz (3.4 kB view details)

Uploaded Source

Built Distributions

AJAS-0.2-py3.7.egg (8.8 kB view details)

Uploaded Source

AJAS-0.2-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file AJAS-0.2.tar.gz.

File metadata

  • Download URL: AJAS-0.2.tar.gz
  • Upload date:
  • Size: 3.4 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

Hashes for AJAS-0.2.tar.gz
Algorithm Hash digest
SHA256 9f78a198eb3ff81d1c01d97e46e870cc57dff57b7b65cd173b7003a5774ca9fe
MD5 a1b06ee43014dc247d9fcaa5911384e6
BLAKE2b-256 e10fb6e58e2aa83bcc3b35bd905af49c74406d23df10e521301dda1d0c8fb18e

See more details on using hashes here.

File details

Details for the file AJAS-0.2-py3.7.egg.

File metadata

  • Download URL: AJAS-0.2-py3.7.egg
  • Upload date:
  • Size: 8.8 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

Hashes for AJAS-0.2-py3.7.egg
Algorithm Hash digest
SHA256 acd14ba2eb1f9ddbae08476c2fc352dc7f954fa6dd60a45715df2ba05221a4b5
MD5 c1b0ac6b2a4e189217a9c28f191ee475
BLAKE2b-256 3db17e7be5dc2931f1e688adc75dba7f373e97f6b6f4b4170d2665fd621cf515

See more details on using hashes here.

File details

Details for the file AJAS-0.2-py3-none-any.whl.

File metadata

  • Download URL: AJAS-0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.5 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

Hashes for AJAS-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ca984fa415d8860b46375615fc9221bdabb94f1c920e0ec63cebf66beef5ab49
MD5 80a04252a6aa37897b3e254a0ae319aa
BLAKE2b-256 aa205933065359069b32a64bfc9010184769d69be1a95212f91d608288c11dde

See more details on using hashes here.

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