Spaces:
Sleeping
Sleeping
Update routers/gmail.py
Browse files- 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 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
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 |
|