mirror of
https://github.com/WhaleFell/SMSBoom.git
synced 2026-02-03 10:23:22 +08:00
🐞 fix: 紧急修复一个严重bug
This commit is contained in:
@@ -58,8 +58,12 @@ class API(BaseModel):
|
||||
:param API: one API basemodel
|
||||
:return: API basemodel
|
||||
"""
|
||||
if isinstance(self.header, str) and self.header:
|
||||
if self.header == "":
|
||||
self.header = {}
|
||||
self.header['Referer'] = self.url # 增加 Referer
|
||||
else:
|
||||
self.header = self.replace_data(self.header, phone)
|
||||
|
||||
self.data = self.replace_data(self.data, phone)
|
||||
self.url = self.replace_data(self.url, phone)
|
||||
return self
|
||||
|
||||
@@ -11,7 +11,6 @@ def test_resq(api: API, phone) -> httpx.Response:
|
||||
:return: httpx 请求对象.
|
||||
"""
|
||||
api = api.handle_API(phone)
|
||||
default_header['Referer'] = api.url
|
||||
with httpx.Client(headers=default_header, timeout=8) as client:
|
||||
if not isinstance(api.data, dict):
|
||||
print("data")
|
||||
|
||||
@@ -88,8 +88,6 @@ def req(api: Union[API, str], phone: tuple):
|
||||
else:
|
||||
phone_lst = [phone]
|
||||
|
||||
# 自动添加 Referer
|
||||
default_header['Referer'] = api.url
|
||||
with httpx.Client(headers=default_header, verify=False) as client:
|
||||
for ph in phone_lst:
|
||||
try:
|
||||
|
||||
@@ -89,7 +89,6 @@ def req(api: Union[API, str], phone: tuple):
|
||||
phone_lst = [_ for _ in phone]
|
||||
else:
|
||||
phone_lst = [phone]
|
||||
default_header['Referer'] = api.url
|
||||
with httpx.Client(headers=default_header, verify=False) as client:
|
||||
for ph in phone_lst:
|
||||
try:
|
||||
|
||||
7
utils.py
7
utils.py
@@ -101,8 +101,11 @@ class API(BaseModel):
|
||||
:return: API basemodel
|
||||
"""
|
||||
# 如果传入的 header 是字符串,就转为字典.
|
||||
if (isinstance(self.header, str) and self.header):
|
||||
self.header = json.loads(self.header.replace("'", '"'))
|
||||
if self.header == "":
|
||||
self.header = {}
|
||||
self.header['Referer'] = self.url # 增加 Referer
|
||||
else:
|
||||
self.header = self.replace_data(self.header, phone)
|
||||
|
||||
self.data = self.replace_data(self.data, phone)
|
||||
self.url = self.replace_data(self.url, phone)
|
||||
|
||||
Reference in New Issue
Block a user