Skip to content

Commit ed2072c

Browse files
Fixed issue where exception would be raised if the email contained the keyword "token"
Added a check to see if data contains the "token" keyword as well. Previously, if the email contained the "token" keyword, it would raise an exception since data dict wouldn't have that certain key.
1 parent fb538e8 commit ed2072c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

TempMail/TempMail.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def getEmails(inbox):
5353
data = json.loads(s)
5454

5555
#Raise an exception if the token is invalid
56-
if "token" in s:
56+
if "token" in s and "token" in data:
5757
if data["token"] == "invalid":
5858
raise Exception("Invalid Token")
5959

@@ -66,4 +66,4 @@ def getEmails(inbox):
6666
for email in data["email"]:
6767
emails.append(Email(email["from"], email["to"], email["subject"], email["body"], email["html"], email["date"]))
6868
return emails
69-
69+

0 commit comments

Comments
 (0)