mirror of
https://github.com/WhaleFell/SMSBoom.git
synced 2026-02-10 14:04:57 +08:00
🐞 fix: 修复若干bug
This commit is contained in:
17
api.json
17
api.json
@@ -38,5 +38,22 @@
|
||||
"dial_code": "0086",
|
||||
"phone": "[phone]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"desc": "踢米app",
|
||||
"url": "https://www.timing360.com/user/send-captcha",
|
||||
"method": "POST",
|
||||
"header": {
|
||||
"Authorization": "7119181942667E7D85987C65A6D0B8EC",
|
||||
"Content-Type": "application/x-www-form-urlencoded"
|
||||
},
|
||||
"data": "_app_version=10.13.2&_carrier=&_city=&_country=&_country_code=&_date=2022-04-05&_device_id=b6ad5aabe403d839&_device_manufacturer=Netease&_device_model=MuMu&_device_os=Android&_device_os_version=6.0.1&_distinct_id=a86d6bb7-8e26-43c5-baf3-82cdf95fffdd&_ip=&_is_login_id=0&_login_method=phone&_network_type=WIFI&_province=&_screen_height=2000&_screen_width=1125&_time=2022-04-05%2021%3A21%3A13&_user_id=a86d6bb7-8e26-43c5-baf3-82cdf95fffdd&_wifi=1&adCode=&brand=Android&city=&cityCode=&countryCode=86&imei=861151055733959&isCheckPhoneExist=0&latitude=&longitude=&market=yyb&nonce=708380&os=6.0.1&osType=1&phoneModel=MuMu&phoneNumber=[phone]&sessionId=e1c69361-c78b-4f4d-8c98-938ba4eccff6×tamp=[timestamp]&userID=-709178027&userKey=11111111111111111111111111111111&versioncode=187"
|
||||
},
|
||||
{
|
||||
"desc": "微爱app",
|
||||
"url": "http://api.welove520.com/v5/account/phone/verifyCode/send?phone_number=[phone]&client_id=464847866_[timestamp]&type=6&area_code=86&app_key=ac5f34563a4344c4&sig=xvP64W04tR%2FNJoZEJEoJySmlIXU%3D",
|
||||
"method": "POST",
|
||||
"header": "",
|
||||
"data": ""
|
||||
}
|
||||
]
|
||||
@@ -34,12 +34,6 @@ class API(BaseModel):
|
||||
header: Optional[Union[str, dict]] = default_header
|
||||
data: Optional[Union[str, dict]]
|
||||
|
||||
@validator('url')
|
||||
def name_must_contain_space(cls, v: str):
|
||||
"""验证链接是否正确"""
|
||||
if not v.startswith('https' or 'http'):
|
||||
raise ValueError('url must startswith http(s)!')
|
||||
return v
|
||||
|
||||
def replace_data(self, content: Union[str, dict], phone) -> str:
|
||||
if not phone:
|
||||
@@ -62,9 +56,9 @@ class API(BaseModel):
|
||||
:param API: one API basemodel
|
||||
:return: API basemodel
|
||||
"""
|
||||
if isinstance(self.data, str):
|
||||
if self.data:
|
||||
self.data = json.loads(self.data)
|
||||
# if isinstance(self.data, str):
|
||||
# if self.data:
|
||||
# self.data = json.loads(self.data)
|
||||
if isinstance(self.header, str):
|
||||
if self.header:
|
||||
self.header = json.loads(self.header)
|
||||
@@ -82,11 +76,11 @@ def test_resq(api: API, phone) -> httpx.Response:
|
||||
api = api.handle_API(phone)
|
||||
with httpx.Client(headers=default_header, timeout=8) as client:
|
||||
if not isinstance(api.data, dict):
|
||||
# print("data")
|
||||
print("data")
|
||||
resp = client.request(method=api.method, headers=api.header,
|
||||
url=api.url, data=api.data)
|
||||
else:
|
||||
# print('json')
|
||||
print('json')
|
||||
resp = client.request(
|
||||
method=api.method, headers=api.header, url=api.url, json=api.data)
|
||||
return resp
|
||||
|
||||
Reference in New Issue
Block a user