Files
2023-01-13 12:12:49 +03:00
..
2023-01-13 12:12:49 +03:00
2022-12-14 15:35:06 +03:00
2022-12-15 18:31:39 +03:00
2022-12-20 15:37:10 +03:00

vue-apps-py

This is a library provided as a building block for your Vue Apps written on Python 3

You will probably need to install uvicorn to launch a server built with FastAPI

python3 -m pip install "uvicorn[standard]"

After importing an app such as main.py:

from typing import List
from vue_apps_py.client import ClientAPI
from vue_apps_py.models import AutoModel, SuggestionsModel
from vue_apps_py.server import VueApp, name_intents
from vue_apps_py.server_utils.intents import Intent, InlineQuery
from vue_apps_py.server_utils.security import SecurityHelper


def autocomplete_handler(query_model: AutoModel) -> SuggestionsModel:
    # Just log the query
    print(query_model.json())

    # Send back empty model
    return SuggestionsModel()


# Initialize API
api = ClientAPI(client_id='vue-app-0', client_secret='abccf12389efab222')

# Prepare Security
key_holder = SecurityHelper(public_key='VoMMy/A7u6GnSajiZbwz0fpIPESA+oQ+b8Qi5LUMiN8=')

# Define intents
intents: List[Intent] = [InlineQuery(autocomplete_handler)]
named_intents = name_intents(intents)

# Get Vue Application Server
vue_app = VueApp(client_api=api, security_helper=key_holder, named_intents=named_intents, debug=True)

You can launch web server:

uvicorn main:vue_app --reload