refactored code

This commit is contained in:
Raju Komati
2023-04-29 15:50:18 +05:30
parent 1981d379d5
commit d555d0c247
5 changed files with 39 additions and 45 deletions

View File

@@ -23,21 +23,17 @@ class Mail:
"sec-fetch-dest": "empty", "sec-fetch-dest": "empty",
"referer": "https://mail.tm/", "referer": "https://mail.tm/",
"accept-encoding": "gzip, deflate, br", "accept-encoding": "gzip, deflate, br",
"accept-language": "en-GB,en-US;q=0.9,en;q=0.8" "accept-language": "en-GB,en-US;q=0.9,en;q=0.8",
} }
def get_mail(self) -> str: def get_mail(self) -> str:
token = ''.join(choices(ascii_letters, k=14)).lower() token = ''.join(choices(ascii_letters, k=14)).lower()
init = self.client.post("https://api.mail.tm/accounts", json={ init = self.client.post(
"address": f"{token}@bugfoo.com", "https://api.mail.tm/accounts", json={"address": f"{token}@bugfoo.com", "password": token}
"password": token )
})
if init.status_code == 201: if init.status_code == 201:
resp = self.client.post("https://api.mail.tm/token", json={ resp = self.client.post("https://api.mail.tm/token", json={**init.json(), "password": token})
**init.json(),
"password": token
})
self.client.headers['authorization'] = 'Bearer ' + resp.json()['token'] self.client.headers['authorization'] = 'Bearer ' + resp.json()['token']

View File

@@ -42,9 +42,7 @@ class Emailnator:
while True: while True:
sleep(2) sleep(2)
mail_token = self.client.post( mail_token = self.client.post("https://www.emailnator.com/message-list", json={"email": self.email})
"https://www.emailnator.com/message-list", json={"email": self.email}
)
mail_token = loads(mail_token.text)["messageData"] mail_token = loads(mail_token.text)["messageData"]

View File

@@ -2,7 +2,7 @@
name = "openai-rev" name = "openai-rev"
version = "0.1.0" version = "0.1.0"
description = "" description = ""
authors = ["Raju Komati <komatiraju032@gmail.com>"] authors = []
license = "GPL-3.0" license = "GPL-3.0"
readme = "README.md" readme = "README.md"
packages = [{ include = "gpt4free" }] packages = [{ include = "gpt4free" }]