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
Pyrin is an application framework built on top of Flask micro-framework to make life easier for developers who want to develop an enterprise application using Flask

Pyrin A rich, fast, performant and easy to use application framework to build apps using Flask on top of it. Pyrin is an application framework built o

Mohamad Nobakht 10 Jan 25, 2022
Chisel is a light-weight Python WSGI application framework built for creating well-documented, schema-validated JSON web APIs

chisel Chisel is a light-weight Python WSGI application framework built for creating well-documented, schema-validated JSON web APIs. Here are its fea

Craig Hobbs 2 Dec 2, 2021
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

null 5.8k Dec 30, 2022
Trame let you weave various components and technologies into a Web Application solely written in Python.

Trame Trame aims to be a framework for building interactive applications using a web front-end in plain Python. Such applications can be used locally

Kitware, Inc. 85 Dec 29, 2022
The comprehensive WSGI web application library.

Werkzeug werkzeug German noun: "tool". Etymology: werk ("work"), zeug ("stuff") Werkzeug is a comprehensive WSGI web application library. It began as

The Pallets Projects 6.2k Jan 1, 2023
Dockerized web application on Starlite, SQLAlchemy1.4, PostgreSQL

Production-ready dockerized async REST API on Starlite with SQLAlchemy and PostgreSQL

Artur Shiriev 10 Jan 3, 2023
Free and open source full-stack enterprise framework for agile development of secure database-driven web-based applications, written and programmable in Python.

Readme web2py is a free open source full-stack framework for rapid development of fast, scalable, secure and portable database-driven web-based applic

null 2k Dec 31, 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 4, 2023
cirrina is an opinionated asynchronous web framework based on aiohttp

cirrina cirrina is an opinionated asynchronous web framework based on aiohttp. Features: HTTP Server Websocket Server JSON RPC Server Shared sessions

André Roth 32 Mar 5, 2022
FPS, fast pluggable server, is a framework designed to compose and run a web-server based on plugins.

FPS, fast pluggable server, is a framework designed to compose and run a web-server based on plugins. It is based on top of fastAPI, uvicorn, typer, and pluggy.

Adrien Delsalle 1 Nov 16, 2021