forked from xtekky/gpt4free
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request xtekky#304 from taiyi747/main
backup options to Emailnator
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from requests import Session | ||
from time import sleep | ||
from json import loads | ||
from re import findall | ||
class Mail: | ||
def __init__(self) -> None: | ||
self.client = Session() | ||
self.client.post("https://etempmail.com/") | ||
self.cookies = {'acceptcookie': 'true'} | ||
self.cookies["ci_session"] = self.client.cookies.get_dict()["ci_session"] | ||
self.email = None | ||
def get_mail(self): | ||
respone=self.client.post("https://etempmail.com/getEmailAddress") | ||
#cookies | ||
self.cookies["lisansimo"] = eval(respone.text)["recover_key"] | ||
self.email = eval(respone.text)["address"] | ||
return self.email | ||
def get_message(self): | ||
print("Waiting for message...") | ||
while True: | ||
sleep(5) | ||
respone=self.client.post("https://etempmail.com/getInbox") | ||
mail_token=loads(respone.text) | ||
print(self.client.cookies.get_dict()) | ||
if len(mail_token) == 1: | ||
break | ||
|
||
params = {'id': '1',} | ||
self.mail_context = self.client.post("https://etempmail.com/getInbox",params=params) | ||
self.mail_context = eval(self.mail_context.text)[0]["body"] | ||
return self.mail_context | ||
#,cookies=self.cookies | ||
def get_verification_code(self): | ||
message = self.mail_context | ||
code = findall(r';">(\d{6,7})</div>', message)[0] | ||
print(f"Verification code: {code}") | ||
return code |