diff --git a/flask_app/utils.py b/flask_app/utils.py index ffe3691..d70936e 100644 --- a/flask_app/utils.py +++ b/flask_app/utils.py @@ -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") diff --git a/smsboom.py b/smsboom.py index c0a5486..63c57a2 100644 --- a/smsboom.py +++ b/smsboom.py @@ -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: diff --git a/smsboom_pyinstall.py b/smsboom_pyinstall.py index b2ba648..93a8d4a 100644 --- a/smsboom_pyinstall.py +++ b/smsboom_pyinstall.py @@ -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: