Asita is a web application framework for python based on express-js framework.

Overview

What is Asita ?

Asita is a web application framework for python. It is designed to be easy to use and be more easy for javascript users to use python frameworks because it is based on express-js framework.

License

How to install Asita ?

Install this package using pip

$ pip install asita

Documentation

Get started

Exemple

from asita import Application

# creating application instance
app = Application()

# callback when web server is ready
def listen_callback(error):
    if error:
        raise error
    print(f"Server listening on port 1000.")

# listen the webserver on port (for instance port 1000)
app.listen(1000, lambda error: listen_callback(error))

Application class

Methods

Name Parameters Description
all(path, callback) path: string, callback: function Routes an HTTP request, where all is the HTTP method such as GET, PUT, POST, OATCH, DELETE, HEAD
post(path, callback) path: string, callback: function Routes HTTP POST requests
get(path, callback) path: string, callback: function Routes HTTP GET requests
put(path, callback) path: string, callback: function Routes HTTP PUT requests
patch(path, callback) path: string, callback: function Routes HTTP PATCH requests
delete(path, callback) path: string, callback: function Routes HTTP DELETE requests
head(path, callback) path: string, callback: function Routes HTTP HEAD requests
define_asset(name, directory) name: string, directory: string Define the asset directory access
listen(port, callback) port: integer, callback: function start listening a port

Create a route

Exemple

# some awesome things check request and response methods :-)
def home(request, response):
    pass

# "/" is the default path
app.all("/", lambda req, res: home(req, res))

To see more example, check the example file.

Request class

Attributs

Name Description
headers headers of the request
session client session
path the url's path
request_type type of request
server_address address of the requested server
server_version version of the requested server
protocol_version version of the HTTP protocol
body the body content of the POST request
query url params

Methods

Name Parameters Description
get(value) value: string get a header of the request
accepts() none get types which are accepted

Response class

Methods

Name Parameters Description
status(code) code: HttpResponses return the response's state
set_header(key, value) key: string, value: string add/update headers
send(data, type?, encoded?) data: object, type: string, encoded: boolean, is_asset: boolean send response
json(data) data: dict write json on a page
render(path) path: string render html file.
end() none stop the current request

? means that it is optionnal

Sessions class

Name Parameters Description
add() none create new empty session
all() none get all sessions
has(sessionId) key: string verify if a session exists
get(sessionId) key: string get a session by id
delete(sessionId) key: string delete session by id
radnom_session_id @Static method none get all sessions

Session class

Name Parameters Description
get_session_id none get the id of the session
set(key, value) key: string, value: string add data to the client session
has(key) key: string verify if client session has the selected data
get(key) key: string get data from client session
delete(key) key: string delete data from client session
all() none get client session data

Enumerations

HttpMethods

HTTP Methods
GET
POST
PUT
DELETE
PATCH
HEAD
ALL

HttpResponses

Client side

Response types Codes
OK 200
NO_CONTENT 204
UNAUTHORIZED 401
FORBIDDEN 403
NOT_FOUND 404
BAD_REQUEST 400

Server side

Response types Codes
INTERNAL_SERVER_ERROR 500

License

MIT LICENSE

You might also like...
Web framework based on type hint。

Hint API 中文 | English 基于 Type hint 的 Web 框架 hintapi 文档 hintapi 实现了 WSGI 接口,并使用 Radix Tree 进行路由查找。是最快的 Python web 框架之一。一切特性都服务于快速开发高性能的 Web 服务。 大量正确的类型

Simple and rapid application development framework, built on top of Flask. includes detailed security, auto CRUD generation for your models, google charts and much more. Demo (login with guest/welcome) - http://flaskappbuilder.pythonanywhere.com/ Async Python 3.6+ web server/framework | Build fast. Run fast.
Async Python 3.6+ web server/framework | Build fast. Run fast.

Sanic | Build fast. Run fast. Build Docs Package Support Stats Sanic is a Python 3.6+ web server and web framework that's written to go fast. It allow

Fast, asynchronous and elegant Python web framework.
Fast, asynchronous and elegant Python web framework.

Warning: This project is being completely re-written. If you're curious about the progress, reach me on Slack. Vibora is a fast, asynchronous and eleg

The Python micro framework for building web applications.

Flask Flask is a lightweight WSGI web application framework. It is designed to make getting started quick and easy, with the ability to scale up to co

Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed.

Tornado Web Server Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed. By using non-blocking ne

Async Python 3.6+ web server/framework | Build fast. Run fast.
Async Python 3.6+ web server/framework | Build fast. Run fast.

Sanic | Build fast. Run fast. Build Docs Package Support Stats Sanic is a Python 3.6+ web server and web framework that's written to go fast. It allow

bottle.py is a fast and simple micro-framework for python web-applications.

Bottle: Python Web Framework Bottle is a fast, simple and lightweight WSGI micro web-framework for Python. It is distributed as a single file module a

Pyramid - A Python web framework

Pyramid Pyramid is a small, fast, down-to-earth, open source Python web framework. It makes real-world web application development and deployment more

Releases(v0.2.5-alpha)
  • v0.2.5-alpha(Nov 10, 2021)

  • v0.2.0-apha(Nov 7, 2021)

    Fixed:

    1. Session : reworked all session system
    2. Issue with routes : you can't add a lot of HTTP method for one route
    3. Removed methods and properties
    4. Adding Sessions class and Session class instead of CookieParser class
    5. Adding examples

    [-] CookieParser [+] Session, Sessions

    Source code(tar.gz)
    Source code(zip)
  • v0.1.0-alpha(Nov 6, 2021)

Owner
Mattéo
French developer
Mattéo
Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed.

Tornado Web Server Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed. By using non-blocking ne

20.9k Jan 01, 2023
WAZO REST API for the call management of the C4 infrastructure

wazo-router-calld wazo-router-calld provides REST API for the C4 infrastructure. Installing wazo-router-calld The server is already provided as a part

Wazo Platform 4 Dec 21, 2022
Web3.py plugin for using Flashbots' bundle APIs

This library works by injecting a new module in the Web3.py instance, which allows submitting "bundles" of transactions directly to miners. This is do

Flashbots 293 Dec 31, 2022
A framework that let's you compose websites in Python with ease!

Perry Perry = A framework that let's you compose websites in Python with ease! Perry works similar to Qt and Flutter, allowing you to create componen

Linkus 13 Oct 09, 2022
A Flask API REST to access words' definition

A Flask API to access words' definitions

Pablo Emídio S.S 9 Jul 22, 2022
A tool for quickly creating REST/HATEOAS/Hypermedia APIs in python

ripozo Ripozo is a tool for building RESTful/HATEOAS/Hypermedia apis. It provides strong, simple, and fully qualified linking between resources, the a

Vertical Knowledge 198 Jan 07, 2023
The Python micro framework for building web applications.

Flask Flask is a lightweight WSGI web application framework. It is designed to make getting started quick and easy, with the ability to scale up to co

The Pallets Projects 61.5k Jan 06, 2023
aiohttp-ratelimiter is a rate limiter for the aiohttp.web framework.

aiohttp-ratelimiter aiohttp-ratelimiter is a rate limiter for the aiohttp.web fr

JGL Technologies 4 Dec 11, 2022
web.py is a web framework for python that is as simple as it is powerful.

web.py is a web framework for Python that is as simple as it is powerful. Visit http://webpy.org/ for more information. The latest stable release 0.62

5.8k Dec 30, 2022
REST API framework designed for human beings

Eve Eve is an open source Python REST API framework designed for human beings. It allows to effortlessly build and deploy highly customizable, fully f

eve 6.6k Jan 07, 2023
Flask-Potion is a RESTful API framework for Flask and SQLAlchemy, Peewee or MongoEngine

Flask-Potion Description Flask-Potion is a powerful Flask extension for building RESTful JSON APIs. Potion features include validation, model resource

DTU Biosustain 491 Dec 08, 2022
The no-nonsense, minimalist REST and app backend framework for Python developers, with a focus on reliability, correctness, and performance at scale.

The Falcon Web Framework Falcon is a reliable, high-performance Python web framework for building large-scale app backends and microservices. It encou

Falconry 9k Jan 01, 2023
Daniel Vaz Gaspar 4k Jan 08, 2023
Python implementation of the Javascript Object Signing and Encryption (JOSE) framework

Python implementation of the Javascript Object Signing and Encryption (JOSE) framework

Demonware 94 Nov 20, 2022
APIFlask is a lightweight Python web API framework based on Flask and marshmallow-code projects

APIFlask APIFlask is a lightweight Python web API framework based on Flask and marshmallow-code projects. It's easy to use, highly customizable, ORM/O

Grey Li 705 Jan 04, 2023
CherryPy is a pythonic, object-oriented HTTP framework. https://docs.cherrypy.org/

Welcome to the GitHub repository of CherryPy! CherryPy is a pythonic, object-oriented HTTP framework. It allows building web applications in much the

CherryPy 1.6k Dec 29, 2022
Flask Sugar is a web framework for building APIs with Flask, Pydantic and Python 3.6+ type hints.

Flask Sugar is a web framework for building APIs with Flask, Pydantic and Python 3.6+ type hints. check parameters and generate API documents automatically. Flask Sugar是一个基于flask,pyddantic,类型注解的API框架

162 Dec 26, 2022
A Python package to easily create APIs in Python.

API_Easy An Python Package for easily create APIs in Python pip install easy-api-builder Requiremnets: = python 3.6 Required modules -- Flask Docume

Envyre-Coding 2 Jan 04, 2022
Appier is an object-oriented Python web framework built for super fast app development.

Joyful Python Web App development Appier is an object-oriented Python web framework built for super fast app development. It's as lightweight as possi

Hive Solutions 122 Dec 22, 2022
Swagger/OpenAPI First framework for Python on top of Flask with automatic endpoint validation & OAuth2 support

Connexion Connexion is a framework that automagically handles HTTP requests based on OpenAPI Specification (formerly known as Swagger Spec) of your AP

Zalando SE 4.2k Jan 07, 2023