mirror of
https://github.com/WhaleFell/SMSBoom.git
synced 2026-02-07 20:34:23 +08:00
✨ feat: 给请求自动添加 Referer
This commit is contained in:
@@ -11,6 +11,7 @@ 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")
|
||||
|
||||
@@ -70,7 +70,6 @@ def load_getapi() -> list:
|
||||
# return None
|
||||
raise ValueError
|
||||
|
||||
|
||||
def reqAPI(api: API, client: httpx.Client) -> httpx.Response:
|
||||
if isinstance(api.data, dict):
|
||||
resp = client.request(method=api.method, json=api.data,
|
||||
@@ -89,6 +88,8 @@ 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,7 @@ 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:
|
||||
|
||||
Reference in New Issue
Block a user