Omkar008 commited on
Commit
04f2865
1 Parent(s): 696d2f7

Update routers/gmail.py

Browse files
Files changed (1) hide show
  1. routers/gmail.py +13 -13
routers/gmail.py CHANGED
@@ -5,19 +5,19 @@ router = APIRouter(prefix="/process")
5
 
6
  @router.post("/receipt_data/direct")
7
  async def get_data(request:Request):
8
- # try:
9
- body_data = await request.json()
10
- token = body_data.get('data')
11
- user_str = body_data.get('brand_name')
12
- if token is None:
13
- return HTTPException(status_code=400,detail="Token Invalid!")
14
- if user_str is None:
15
- user_str = None
16
-
17
- fetch_data = gmail_controller.GmailDataExtractor(token , user_str).extract_messages()
18
- return fetch_data
19
- # except Exception as e:
20
- # raise HTTPException(status_code=500, detail=str(e))
21
 
22
 
23
 
 
5
 
6
  @router.post("/receipt_data/direct")
7
  async def get_data(request:Request):
8
+ try:
9
+ body_data = await request.json()
10
+ token = body_data.get('data')
11
+ user_str = body_data.get('brand_name')
12
+ if token is None:
13
+ return HTTPException(status_code=400,detail="Token Invalid!")
14
+ if user_str is None:
15
+ user_str = None
16
+
17
+ fetch_data = gmail_controller.GmailDataExtractor(token , user_str).extract_messages()
18
+ return fetch_data
19
+ except Exception as e:
20
+ raise HTTPException(status_code=500, detail=str(e))
21
 
22
 
23