mirror of
https://github.com/WhaleFell/SMSBoom.git
synced 2026-05-09 15:02:37 +08:00
feat: 添加代理,随机UA
1. 通过代理调用短信接口. 2. 随机的User-Agent. 3. 去除循环模式, 新增"设置执行次数"模式, 参数"--frequency | -t", 用于指定要循环执行的次数.
This commit is contained in:
@@ -4,14 +4,15 @@ from pydantic import BaseModel
|
||||
from typing import Union, Optional
|
||||
from datetime import datetime
|
||||
import json
|
||||
from utils import default_header
|
||||
from utils import default_header_user_agent
|
||||
|
||||
|
||||
class API(BaseModel):
|
||||
"""处理自定义 API 数据"""
|
||||
desc: str = "Default"
|
||||
url: str
|
||||
method: str = "GET"
|
||||
header: Optional[Union[str, dict]] = default_header
|
||||
header: Optional[Union[str, dict]] = default_header_user_agent()
|
||||
data: Optional[Union[str, dict]]
|
||||
|
||||
def replace_data(self, content: Union[str, dict], phone: str) -> str:
|
||||
@@ -19,7 +20,7 @@ class API(BaseModel):
|
||||
if phone:
|
||||
content = str(content).replace("[phone]", phone).replace(
|
||||
"[timestamp]", self.timestamp_new()).replace("'", '"')
|
||||
|
||||
|
||||
# 尝试 json 化
|
||||
try:
|
||||
return json.loads(content.replace("'", '"'))
|
||||
@@ -30,7 +31,7 @@ class API(BaseModel):
|
||||
"""返回整数字符串时间戳"""
|
||||
return str(int(datetime.now().timestamp()))
|
||||
|
||||
def handle_API(self, phone: str=None):
|
||||
def handle_API(self, phone: str = None):
|
||||
""" 传入手机号处理 API
|
||||
:param API: one API basemodel
|
||||
:return: API basemodel
|
||||
|
||||
Reference in New Issue
Block a user