| 12345678910111213141516171819202122232425262728293031323334353637 |
- # This Python file uses the following encoding: utf-8
- # @author runhey
- # github https://github.com/runhey
- from fastapi import APIRouter
- from module.logger import logger
- home_app = APIRouter(
- prefix="/home",
- tags=["home"],
- )
- @home_app.get('/test')
- async def home_test():
- return {'message':'test'}
- # gcc -Wall -pedantic -shared -fPIC -o group_work.so group_work.c -lwiringPi
- @home_app.get('/home_menu')
- async def home_menu():
- return {'Home': [], 'Updater': [], 'Tool': []}
- @home_app.post('/notify_test')
- async def notify_test(setting: str, title: str, content: str):
- from module.notify.notify import Notifier
- try:
- notifier = Notifier(setting, True)
- if notifier.push(title=title, content=content):
- del notifier
- return True
- else:
- del notifier
- return False
- except Exception as e:
- logger.exception(e)
- return str(e)
|