Skip to content

Commit

Permalink
[DeveloperMailAPI] Added ignoring errors during parsing messages
Browse files Browse the repository at this point in the history
  • Loading branch information
rzc0d3r authored May 27, 2024
1 parent d173af8 commit d979f61
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions modules/EmailAPIs.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,12 @@ def get_messages(self):
# parse messages
messages = []
for message_id in message_ids:
r = requests.get(f'{self.api_url}/mailbox/{self.email_name}/messages/{message_id}', headers=self.headers)
raw_message_body = r.json()['result']
messages.append(self.__parse_message(raw_message_body))
try:
r = requests.get(f'{self.api_url}/mailbox/{self.email_name}/messages/{message_id}', headers=self.headers)
raw_message_body = r.json()['result']
messages.append(self.__parse_message(raw_message_body))
except:
continue
if messages == []:
messages = None
return messages
Expand Down Expand Up @@ -262,4 +265,4 @@ def get_message(self, message_id):
class CustomEmailAPI(object):
def __init__(self):
self.class_name = 'custom'
self.email = None
self.email = None

0 comments on commit d979f61

Please sign in to comment.