payHook / server /api.py
rogerxavier's picture
Update server/api.py
7f4c5ee verified
from fastapi import FastAPI
from .notify import router as NotifyRouter
from .utils import config
from tablestore import OTSClient
from .account_manager import router as accountManagerRouter
access_key_id='LTAI5tNwpEHCMTupADmx6xA4'
access_key_secret="vX1q5Tvj3LSsIMUXN6SPbMUBCET3qG"
end_point='https://v2b-user-table.ap-southeast-1.ots.aliyuncs.com'
instance_name='v2b-user-table'
table_name = 'user'
primary_key = 'email'
ots_client = OTSClient(
end_point=end_point,
access_key_id=access_key_id,
access_key_secret=access_key_secret,
instance_name=instance_name
)
accountManagerRouter.key = primary_key
accountManagerRouter.ots_client = ots_client
accountManagerRouter.table_name = table_name
#和hook.pixiv.digital/uu兼容 故分开
NotifyRouter.key = primary_key
NotifyRouter.ots_client = ots_client
NotifyRouter.table_name = table_name
app = FastAPI()
@app.get("/config.json", tags=["Root"])
async def read_root() -> dict:
return config
# 全局路由
app.include_router(accountManagerRouter,prefix='/accountManager')
app.include_router(NotifyRouter, prefix=config['notify']) # https://hook.pixiv.digital/uu接受回调
if __name__ == '__main__':
print(config['notify'])