t.me/xtekky
commited on
Revert "unpatch mail"
Browse files- quora/mail.py +40 -16
quora/mail.py
CHANGED
@@ -7,32 +7,56 @@ class Mail:
|
|
7 |
self.client = Session()
|
8 |
self.client.proxies = None #proxies
|
9 |
self.client.headers = {
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36",
|
11 |
-
"
|
12 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
}
|
14 |
|
15 |
-
self.domain = "guerrillamail.com"
|
16 |
-
|
17 |
-
self.sid_token = self.client.get("https://api.guerrillamail.com/ajax.php?f=get_email_address").json()['sid_token']
|
18 |
-
|
19 |
def get_mail(self) -> str:
|
20 |
token = ''.join(choices(ascii_letters, k=10)).lower()
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
def fetch_inbox(self):
|
28 |
-
return self.client.get(f"https://api.
|
29 |
|
30 |
def get_message(self, message_id: str):
|
31 |
-
return self.client.get(f"https://api.
|
32 |
|
33 |
def get_message_content(self, message_id: str):
|
34 |
-
return self.get_message(message_id)["
|
|
|
35 |
|
36 |
# if __name__ == "__main__":
|
37 |
# client = Mail()
|
38 |
-
#
|
|
|
|
|
|
7 |
self.client = Session()
|
8 |
self.client.proxies = None #proxies
|
9 |
self.client.headers = {
|
10 |
+
"host": "api.mail.tm",
|
11 |
+
"connection": "keep-alive",
|
12 |
+
"sec-ch-ua": "\"Google Chrome\";v=\"111\", \"Not(A:Brand\";v=\"8\", \"Chromium\";v=\"111\"",
|
13 |
+
"accept": "application/json, text/plain, */*",
|
14 |
+
"content-type": "application/json",
|
15 |
+
"sec-ch-ua-mobile": "?0",
|
16 |
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36",
|
17 |
+
"sec-ch-ua-platform": "\"macOS\"",
|
18 |
+
"origin": "https://mail.tm",
|
19 |
+
"sec-fetch-site": "same-site",
|
20 |
+
"sec-fetch-mode": "cors",
|
21 |
+
"sec-fetch-dest": "empty",
|
22 |
+
"referer": "https://mail.tm/",
|
23 |
+
"accept-encoding": "gzip, deflate, br",
|
24 |
+
"accept-language": "en-GB,en-US;q=0.9,en;q=0.8"
|
25 |
}
|
26 |
|
|
|
|
|
|
|
|
|
27 |
def get_mail(self) -> str:
|
28 |
token = ''.join(choices(ascii_letters, k=10)).lower()
|
29 |
+
|
30 |
+
init = self.client.post("https://api.mail.tm/accounts", json={
|
31 |
+
"address" : f"{token}@bugfoo.com",
|
32 |
+
"password": token
|
33 |
+
})
|
34 |
+
|
35 |
+
if init.status_code == 201:
|
36 |
+
resp = self.client.post("https://api.mail.tm/token", json = {
|
37 |
+
**init.json(),
|
38 |
+
"password": token
|
39 |
+
})
|
40 |
+
|
41 |
+
self.client.headers['authorization'] = 'Bearer ' + resp.json()['token']
|
42 |
+
|
43 |
+
return f"{token}@bugfoo.com"
|
44 |
+
|
45 |
+
else:
|
46 |
+
raise Exception("Failed to create email")
|
47 |
+
|
48 |
def fetch_inbox(self):
|
49 |
+
return self.client.get(f"https://api.mail.tm/messages").json()["hydra:member"]
|
50 |
|
51 |
def get_message(self, message_id: str):
|
52 |
+
return self.client.get(f"https://api.mail.tm/messages/{message_id}").json()
|
53 |
|
54 |
def get_message_content(self, message_id: str):
|
55 |
+
return self.get_message(message_id)["text"]
|
56 |
+
|
57 |
|
58 |
# if __name__ == "__main__":
|
59 |
# client = Mail()
|
60 |
+
# client.get_mail()
|
61 |
+
|
62 |
+
|