first commit
This commit is contained in:
43
test_email.py
Normal file
43
test_email.py
Normal file
@@ -0,0 +1,43 @@
|
||||
import requests
|
||||
import json
|
||||
import urllib3
|
||||
|
||||
# 禁用SSL警告
|
||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||
|
||||
def test_specific_email():
|
||||
print("开始测试指定邮箱API...")
|
||||
|
||||
# 创建session并配置
|
||||
session = requests.Session()
|
||||
session.verify = False
|
||||
session.trust_env = False
|
||||
|
||||
# 测试URL
|
||||
test_url = "https://tempmail.plus/api/mails?email=ademyyk@mailto.plus&limit=20&epin="
|
||||
|
||||
try:
|
||||
# 不使用代理直接测试
|
||||
print("\n1. 直接连接测试...")
|
||||
response = session.get(test_url)
|
||||
print(f"状态码: {response.status_code}")
|
||||
print(f"响应内容: {json.dumps(response.json(), indent=2, ensure_ascii=False)}")
|
||||
|
||||
except Exception as e:
|
||||
print(f"\n直接连接出错: {e}")
|
||||
|
||||
# 如果直接连接失败,尝试使用代理
|
||||
try:
|
||||
print("\n2. 尝试使用代理...")
|
||||
proxies = {
|
||||
'http': 'http://127.0.0.1:7890',
|
||||
'https': 'http://127.0.0.1:7890'
|
||||
}
|
||||
response = session.get(test_url, proxies=proxies)
|
||||
print(f"状态码: {response.status_code}")
|
||||
print(f"响应内容: {json.dumps(response.json(), indent=2, ensure_ascii=False)}")
|
||||
except Exception as e:
|
||||
print(f"\n代理连接也出错: {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_specific_email()
|
||||
Reference in New Issue
Block a user