Omkar008 commited on
Commit
6112ead
1 Parent(s): 54206e4

Update controllers/fetch_microsoft_mails.py

Browse files
controllers/fetch_microsoft_mails.py CHANGED
@@ -236,6 +236,8 @@ def extract_attachments_from_mail(access_token: str, message_data: dict) -> List
236
  'Accept': 'application/json',
237
  }
238
  attachments_response = requests.get(f'https://graph.microsoft.com/v1.0/me/messages/{message_id}/attachments', headers=headers)
 
 
239
  attachments = attachments_response.json().get('value', [])
240
 
241
  for attachment in attachments:
 
236
  'Accept': 'application/json',
237
  }
238
  attachments_response = requests.get(f'https://graph.microsoft.com/v1.0/me/messages/{message_id}/attachments', headers=headers)
239
+ if attachments_response.status_code != 200 :
240
+ return "No Attachments","Empty Strcutured Data"
241
  attachments = attachments_response.json().get('value', [])
242
 
243
  for attachment in attachments: