Skip to main content

It's a robust webserver (http/ws) for hosting htag apps on the web (a process by user)

Project description

htagweb

Test

Package version

This "htagweb" module provides two htag's "runners":

  • WebServer : for http only exchanges
  • WebServerWS : for http/ws exchanges (first rendering is on http)

Theses runners are a lot more complete than the defaults ones (WebHTTP & WebWS, provided nativly with htag) If you want to expose your HTag apps on the web : they are the only real/official solutions. Theses are a lot robust and IRL tested.

  • based on starlette
  • compatible with uvloop !!!
  • compatible with multiple gunicorn webworkers !!!
  • works on gnu/linux or windows !
  • Each user has its own process (for session, and htag app)
  • real starlette session available (in htag instance, and starlette request)
  • compatible with oauth2 authent ( authlib )
  • real process managments (interactions timeout, process expirations, ...)
  • NOT READY YET parano mode (can aes encrypt all communications between client & server ... to avoid mitm'proxies)

But be aware : it's production ready (at least, for me). It may not be free of bugs or security holes: USE AT YOUR OWN RISK. Htag and this module are youngs, and not widely tested (by experts/hackers). But due to the nature of htag, and theses runners, the risk may be minimal (only DoS), stealing datas may not be possible.

The concepts are the same :

  • one user can run only one instance of an htag app at one time (like in desktop mode).
  • All user processes are destroyed, after an inactivity timeout (not like in desktop mode, to preserve healthy of the webserver)
  • the "session" live as long as the server live (may not be a problem on many hosting service (where they shutdown the server after inactivities))

architecture

Here is a rapid map ;-)

Roadmap / futur

  • ? replace starlette by fastapi ?
  • better logging !!!!
  • more parameters (session size, etc ...)
  • parano mode
  • perhaps a bi-modal version (use ws, and fallback to http when ws com error)

Examples

A "hello world" could be :

from htag import Tag

class App(Tag.div):
    def init(self):
        self+= "hello world"

from htagweb import WebServer # or WebServerWS
WebServer( App ).run()

or, with gunicorn (in a server.py file):

from htag import Tag

class App(Tag.div):
    def init(self):
        self+= "hello world"

from htagweb import WebServer # or WebServerWS
app=WebServer( App )

and run server :

gunicorn -w 4 -k uvicorn.workers.UvicornH11Worker -b localhost:8000 --preload server:app

See a more advanced example in examples folder

python3 examples/main.py

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

htagweb-0.4.0.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

htagweb-0.4.0-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file htagweb-0.4.0.tar.gz.

File metadata

  • Download URL: htagweb-0.4.0.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.2 Linux/5.15.0-1041-azure

File hashes

Hashes for htagweb-0.4.0.tar.gz
Algorithm Hash digest
SHA256 66b6a8e474567523eb88a88454f032c6ff4520b94eb4db7ef49f1a712b9213a1
MD5 af37ca4dda5e1d9c1b83f32446f78d54
BLAKE2b-256 f98b375486c66a5ef458cfd5c81949ad6b019b5ff9d865640adfa05dbe805273

See more details on using hashes here.

File details

Details for the file htagweb-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: htagweb-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.2 Linux/5.15.0-1041-azure

File hashes

Hashes for htagweb-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8a32cf2a1c94c596cef165d0a2f5fda0ac0218ee0d068acf474e62fbc96b3c2e
MD5 d1d3cad07b616e904b383ccdfd0c9cdf
BLAKE2b-256 c28a623e649d2fa25bed6b1b68473db44c6a874c02e0d5b6dbf2e9fbd1bed660

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