FASTAPI demo

from typingimport Union

import uvicorn

from fastapiimport FastAPI

from pydanticimport BaseModel

from commonimport *

app= FastAPI()

class star(BaseModel):

    payload: Union[str,dict]

    key: str

    iv: str

    starsigsecret: str

class aes(BaseModel):

    params: Union[str,dict]

    key: str

    iv: str

class R2sign(BaseModel):

    params: Union[str,dict]

    payloadkey: str

    secretKey: str

@app.post("/notificationsbody/")

async def notifications_sign(star: star):

    return notifications_body(star.payload,

    star.key,

    star.iv,

    star.starsigsecret)

@app.post("/aesencrypt/")

async def aesencrypt(item: aes):

    return aes_encrypt(item.params,

    item.key,

    item.iv)

@app.post("/aesDecrypt/")

async def aesDecrypt(item: aes):

    return aes_Decrypt(item.params,

    item.key,

    item.iv)

@app.post("/R2sign/")

async def R2sign(item: R2sign):

    return R2_sign(item.params,

    item.payloadkey,

    item.secretKey)

if __name__== '__main__':

    uvicorn.run("727:app",host="19.244.48.43",port=9936,reload=True)

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容