示例#1
0
import uuid
from pydantic import BaseModel
from fastapi import APIRouter, HTTPException
from starlette.requests import Request
from helper import to_dict, success, failure, APPCtrl, urlCheck
from cores.mqttc.pubc import MQTTStreamPubBase
from apps.vserial import api
from apps.vserial.pub import MQTTPub
from apps.vserial.manager import VSPAXManager

appname = "vserial"

APIHandler = APIRouter()
APIHandler.Pub = MQTTPub(appname)
APIHandler.Sub = MQTTStreamPubBase(appname, api)
APIHandler.Manager = VSPAXManager(appname, APIHandler.Pub)


class pingItem(BaseModel):
    data: dict
    id: str = None


class installItem(BaseModel):
    gate: str
    auth_code: str
    id: str = None


class stopItem(BaseModel):
    id: str = None
示例#2
0
import uuid
from pydantic import BaseModel
from fastapi import APIRouter, HTTPException
from starlette.requests import Request
from helper import to_dict, success, failure, APPCtrl
from cores.mqttc.pubc import MQTTStreamPubBase
from configparser import ConfigParser
from apps.common.manager import Manager
from apps.common import api


appname = "common"

APIHandler = APIRouter()
APIHandler.Sub = MQTTStreamPubBase(appname, api)
APIHandler.Manager = Manager(appname)


class pingItem(BaseModel):
	data: dict
	id: str = None


class configItem(BaseModel):
	npshost: str
	npsuser:str
	gate: str
	auth_code: str
	id: str = None

示例#3
0
import json
from pydantic import BaseModel
from fastapi import APIRouter, HTTPException
from starlette.requests import Request
from helper import to_dict, success, failure, APPCtrl, is_ipv4, urlCheck
from cores.mqttc.pubc import MQTTStreamPubBase
from apps.vnet import api
from apps.vnet.pub import MQTTPub
from apps.vnet.manager import Manager

appname = "vnet"

APIHandler = APIRouter()
APIHandler.Pub = MQTTPub(appname)
APIHandler.Sub = MQTTStreamPubBase(appname, api)
APIHandler.Manager = Manager(appname, APIHandler.Pub)


class pingItem(BaseModel):
    id: str = None


class stopItem(BaseModel):
    id: str = None


class gateItem(BaseModel):
    gate: str
    auth_code: str = None
    id: str = None