Spaces:
Sleeping
Sleeping
File size: 720 Bytes
d1a66a2 04f2865 d1a66a2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
from fastapi import APIRouter , Request ,HTTPException
from controllers import gmail_controller
router = APIRouter(prefix="/process")
@router.post("/receipt_data/direct")
async def get_data(request:Request):
try:
body_data = await request.json()
token = body_data.get('data')
user_str = body_data.get('brand_name')
if token is None:
return HTTPException(status_code=400,detail="Token Invalid!")
if user_str is None:
user_str = None
fetch_data = gmail_controller.GmailDataExtractor(token , user_str).extract_messages()
return fetch_data
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))
|