summaryrefslogtreecommitdiffstats
path: root/quora/mail.py
diff options
context:
space:
mode:
authort.me/xtekky <98614666+xtekky@users.noreply.github.com>2023-04-27 20:16:07 +0200
committert.me/xtekky <98614666+xtekky@users.noreply.github.com>2023-04-27 20:16:07 +0200
commit10104774c10cccf95bbebcafd17c0a85207583e0 (patch)
tree6fec52831117ee43fe7141a153b7e123ff09d469 /quora/mail.py
parent_ (diff)
parentMerge pull request #205 from AymaneHrouch/reformat__code (diff)
downloadgpt4free-10104774c10cccf95bbebcafd17c0a85207583e0.tar
gpt4free-10104774c10cccf95bbebcafd17c0a85207583e0.tar.gz
gpt4free-10104774c10cccf95bbebcafd17c0a85207583e0.tar.bz2
gpt4free-10104774c10cccf95bbebcafd17c0a85207583e0.tar.lz
gpt4free-10104774c10cccf95bbebcafd17c0a85207583e0.tar.xz
gpt4free-10104774c10cccf95bbebcafd17c0a85207583e0.tar.zst
gpt4free-10104774c10cccf95bbebcafd17c0a85207583e0.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()