File size: 1,029 Bytes
aba7131
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import os
import subprocess
#import logging
from fastapi import FastAPI, Request, HTTPException
import requests
import json
from datetime import datetime
import importlib
import os
import pkgutil
from mysite.libs.utilities import validate_signature, no_process_file
#from mysite.database.database import ride,create_ride
from controllers.gra_04_database.rides import test_set_lide
from typing import List
from fastapi import APIRouter, Depends
from mysite.logger import logger

router = APIRouter(prefix="/process", tags=["messages"])

@router.post("/webhook")
def get_choices(
    messages
):
    logger.info("[Start] ====== LINE webhook ======")
    try:
        now = datetime.now().strftime("%Y%m%d%H%M%S")
        user_id_with_timestamp = messages[:10]
        #user_id_with_timestamp = messages#f"{now}_{title}_{user_id}"
        no_process_file(messages, user_id_with_timestamp)
        #db登録
        test_set_lide(messages, user_id_with_timestamp)
    except Exception as e:
        logger.error("Error: %s", str(e))