Support temporary email PIN code rate and modify the suffix, and by default install PyInstaller.
This commit is contained in:
@@ -1,9 +1,16 @@
|
||||
# 你的CF路由填写的域名
|
||||
DOMAIN=xxxxx.me
|
||||
# 邮件服务地址
|
||||
# 注册临时邮件服务 https://tempmail.plus
|
||||
TEMP_MAIL=xxxxxx
|
||||
# 设置的PIN码
|
||||
TEMP_MAIL_EPIN=xxxxxx
|
||||
# 使用的后缀
|
||||
TEMP_MAIL_EXT=@mailto.plus
|
||||
BROWSER_USER_AGENT=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.6723.92 Safari/537.36
|
||||
|
||||
# 代理
|
||||
# BROWSER_PROXY='http://127.0.0.1:2080'
|
||||
|
||||
# 无头模式
|
||||
# 无头模式 默认开启
|
||||
# BROWSER_HEADLESS='True'
|
||||
|
||||
10
config.py
10
config.py
@@ -25,6 +25,8 @@ class Config:
|
||||
|
||||
self.imap = False
|
||||
self.temp_mail = os.getenv("TEMP_MAIL", "").strip().split("@")[0]
|
||||
self.temp_mail_epin = os.getenv("TEMP_MAIL_EPIN", "").strip()
|
||||
self.temp_mail_ext = os.getenv("TEMP_MAIL_EXT", "").strip()
|
||||
self.domain = os.getenv("DOMAIN", "").strip()
|
||||
|
||||
# 如果临时邮箱为null则加载IMAP
|
||||
@@ -42,6 +44,14 @@ class Config:
|
||||
|
||||
return self.temp_mail
|
||||
|
||||
def get_temp_mail_epin(self):
|
||||
|
||||
return self.temp_mail_epin
|
||||
|
||||
def get_temp_mail_ext(self):
|
||||
|
||||
return self.temp_mail_ext
|
||||
|
||||
def get_imap(self):
|
||||
if not self.imap:
|
||||
return False
|
||||
|
||||
@@ -11,8 +11,9 @@ class EmailVerificationHandler:
|
||||
def __init__(self):
|
||||
self.imap = Config().get_imap()
|
||||
self.username = Config().get_temp_mail()
|
||||
self.epin = Config().get_temp_mail_epin()
|
||||
self.session = requests.Session()
|
||||
self.emailExtension = "@mailto.plus"
|
||||
self.emailExtension = Config().get_temp_mail_ext()
|
||||
|
||||
def get_verification_code(self):
|
||||
code = None
|
||||
@@ -111,7 +112,7 @@ class EmailVerificationHandler:
|
||||
# 手动输入验证码
|
||||
def _get_latest_mail_code(self):
|
||||
# 获取邮件列表
|
||||
mail_list_url = f"https://tempmail.plus/api/mails?email={self.username}{self.emailExtension}&limit=20&epin="
|
||||
mail_list_url = f"https://tempmail.plus/api/mails?email={self.username}{self.emailExtension}&limit=20&epin={self.epin}"
|
||||
mail_list_response = self.session.get(mail_list_url)
|
||||
mail_list_data = mail_list_response.json()
|
||||
time.sleep(0.5)
|
||||
@@ -124,7 +125,7 @@ class EmailVerificationHandler:
|
||||
return None, None
|
||||
|
||||
# 获取具体邮件内容
|
||||
mail_detail_url = f"https://tempmail.plus/api/mails/{first_id}?email={self.username}{self.emailExtension}&epin="
|
||||
mail_detail_url = f"https://tempmail.plus/api/mails/{first_id}?email={self.username}{self.emailExtension}&epin={self.epin}"
|
||||
mail_detail_response = self.session.get(mail_detail_url)
|
||||
mail_detail_data = mail_detail_response.json()
|
||||
time.sleep(0.5)
|
||||
@@ -146,7 +147,7 @@ class EmailVerificationHandler:
|
||||
payload = {
|
||||
"email": f"{self.username}{self.emailExtension}",
|
||||
"first_id": first_id,
|
||||
"epin": "",
|
||||
"epin": f"{self.epin}",
|
||||
}
|
||||
|
||||
# 最多尝试5次
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
DrissionPage==4.1.0.9
|
||||
colorama==0.4.6
|
||||
python-dotenv==1.0.0
|
||||
pyinstaller
|
||||
Reference in New Issue
Block a user