summaryrefslogtreecommitdiffstats
path: root/quora/mail.py
diff options
context:
space:
mode:
authorAndrew Tsegaye <andrewtsegaye7@gmail.com>2023-04-27 03:12:33 +0200
committerAndrew Tsegaye <andrewtsegaye7@gmail.com>2023-04-27 03:12:33 +0200
commitd72c33b680b25d353f5cdb4f77fd3429e22cb73b (patch)
treef5550359f24a8c9b9e9a3514620ab5547ff48a82 /quora/mail.py
parentMerge pull request #157 from phishontop/main (diff)
downloadgpt4free-d72c33b680b25d353f5cdb4f77fd3429e22cb73b.tar
gpt4free-d72c33b680b25d353f5cdb4f77fd3429e22cb73b.tar.gz
gpt4free-d72c33b680b25d353f5cdb4f77fd3429e22cb73b.tar.bz2
gpt4free-d72c33b680b25d353f5cdb4f77fd3429e22cb73b.tar.lz
gpt4free-d72c33b680b25d353f5cdb4f77fd3429e22cb73b.tar.xz
gpt4free-d72c33b680b25d353f5cdb4f77fd3429e22cb73b.tar.zst
gpt4free-d72c33b680b25d353f5cdb4f77fd3429e22cb73b.zip
Diffstat (limited to '')
-rw-r--r--quora/mail.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/quora/mail.py b/quora/mail.py
index c4707860..e6ce96c2 100644
--- a/quora/mail.py
+++ b/quora/mail.py
@@ -38,7 +38,7 @@ class Emailnator:
return self.email
def get_message(self):
- print("waiting for code...")
+ print("Waiting for message...")
while True:
sleep(2)
@@ -49,6 +49,7 @@ class Emailnator:
mail_token = loads(mail_token.text)["messageData"]
if len(mail_token) == 2:
+ print("Message received!")
print(mail_token[1]["messageID"])
break
@@ -63,4 +64,19 @@ class Emailnator:
return mail_context.text
def get_verification_code(self):
- return findall(r';">(\d{6,7})</div>', self.get_message())[0]
+ message = self.get_message()
+ code = findall(r';">(\d{6,7})</div>', message)[0]
+ print(f"Verification code: {code}")
+ return code
+
+ def clear_inbox(self):
+ print("Clearing inbox...")
+ self.client.post(
+ "https://www.emailnator.com/delete-all",
+ json={"email": self.email},
+ )
+ print("Inbox cleared!")
+
+ def __del__(self):
+ if self.email:
+ self.clear_inbox()