Example #1
0
else:
    CONST = ALL_CONST[ENV]

# setup
app = FastAPI(
    title="Kampuan project",
    description=
    "Welcome,This is a project using python to do คำผวน by Tanawat C. ",
    version="0.0.1",
)

line_bot_api = LineBotApi(CHANNEL_ACCESS_TOKEN)
handler = WebhookHandler(CHANNEL_SECRET)
db = FireBaseDb(credential_json=GOOGLE_APPLICATION_CREDENTIALS, env=ENV)
# db.test()
bot_info = line_bot_api.get_bot_info()

bot_command = BotCommand(bot_name=bot_info.display_name, bot_env=ENV)
# %%


@app.post("/callback", include_in_schema=False)
async def callback(request: Request):

    # get X-Line-Signature header value]
    signature = request.headers['x-line-signature']

    # get request body as text
    body = await request.body()
    body = body.decode('utf-8')
    print("Request body: " + body)