This commit is contained in:
huangzhenpc
2025-02-26 10:21:48 +08:00
parent a9e29c9cf5
commit 5cc138b69a
3 changed files with 38 additions and 25 deletions

View File

@@ -5,6 +5,7 @@ import requests
import json
import time
import logging
import re
class EmailApiClient:
"""
@@ -12,7 +13,7 @@ class EmailApiClient:
用于在批量注册场景中与邮件系统API交互
"""
def __init__(self, api_base_url="http://localhost:5000/api", timeout=10):
def __init__(self, api_base_url="http://74.48.75.19:5000/api", timeout=10):
"""
初始化API客户端
@@ -22,15 +23,17 @@ class EmailApiClient:
"""
self.api_base_url = api_base_url
self.timeout = timeout
self.logger = logging.getLogger("EmailApiClient")
# 设置日志
self.logger = logging.getLogger("EmailApiClient")
if not self.logger.handlers:
handler = logging.StreamHandler()
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
self.logger.addHandler(handler)
self.logger.setLevel(logging.INFO)
self.logger.info(f"初始化API客户端: {api_base_url}")
def get_emails_by_address(self, email_address, limit=10, unread_only=False, since=None):
"""
@@ -151,8 +154,6 @@ class EmailApiClient:
if email.get('verification_code'):
return email.get('verification_code')
import re
# 默认验证码模式
default_patterns = [
r'验证码[:\s]+(\d{4,8})',