Merge branch 'main' of https://git.solsynth.dev/nanci/SolianForPython
This commit is contained in:
@@ -10,12 +10,12 @@ class AuthClient:
|
||||
self.stage = 'find-account'
|
||||
self.error = None
|
||||
self.account_identifier = ''
|
||||
self.device_id = ''
|
||||
self.challenge = None
|
||||
self.factors = []
|
||||
self.selected_factor_id = None
|
||||
self.password = ''
|
||||
self.user_store = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3' # 您可以自定义此User-Agent字符串
|
||||
self.user_store = f"SolianForPythonApp/0.000.001({platform.system()})" # 您可以自定义此User-Agent字符串
|
||||
self.device_id = self.user_store
|
||||
|
||||
def generate_device_id(self):
|
||||
"""生成设备指纹
|
||||
@@ -41,7 +41,7 @@ class AuthClient:
|
||||
try:
|
||||
response = requests.post(
|
||||
f"{self.base_url}/auth/challenge",
|
||||
headers={'Content-Type': 'application/json', 'User-Agent': self.user_store,'device_name': "A Python login app.By NRFF & Deepseek"}, # 添加自定义User-Agent
|
||||
headers={'Content-Type': 'application/json', 'User-Agent': self.user_store,"device_id":self.device_id}, # 添加自定义User-Agent
|
||||
data=json.dumps({
|
||||
'platform': 1,
|
||||
'account': self.account_identifier,
|
||||
@@ -68,7 +68,7 @@ class AuthClient:
|
||||
try:
|
||||
response = requests.get(
|
||||
f"{self.base_url}/auth/challenge/{self.challenge['id']}/factors",
|
||||
headers={'User-Agent': self.user_store,'device_name': "A Python login app.By NRFF & Deepseek"} # 添加自定义User-Agent
|
||||
headers={'User-Agent': self.user_store,"device_id":self.device_id} # 添加自定义User-Agent
|
||||
)
|
||||
if not response.ok:
|
||||
raise Exception('Could not fetch authentication factors.')
|
||||
@@ -102,7 +102,7 @@ class AuthClient:
|
||||
try:
|
||||
response = requests.post(
|
||||
f"{self.base_url}/auth/challenge/{self.challenge['id']}/factors/{self.selected_factor_id}",
|
||||
headers={'Content-Type': 'application/json', 'User-Agent': self.user_store, 'device_name': "A Python login app.By NRFF & Deepseek"}, # 添加自定义User-Agent
|
||||
headers={'Content-Type': 'application/json', 'User-Agent': self.user_store,"device_id":self.device_id}, # 添加自定义User-Agent
|
||||
data=json.dumps(hint)
|
||||
)
|
||||
if not response.ok:
|
||||
@@ -136,7 +136,7 @@ class AuthClient:
|
||||
try:
|
||||
response = requests.patch(
|
||||
f"{self.base_url}/auth/challenge/{self.challenge['id']}",
|
||||
headers={'Content-Type': 'application/json', 'User-Agent': self.user_store,'device_name': "A Python login app.By NRFF & Deepseek"}, # 添加自定义User-Agent
|
||||
headers={'Content-Type': 'application/json', 'User-Agent': self.user_store,"device_id":self.device_id}, # 添加自定义User-Agent
|
||||
data=json.dumps({
|
||||
'factor_id': self.selected_factor_id,
|
||||
'password': self.password,
|
||||
@@ -165,7 +165,7 @@ class AuthClient:
|
||||
try:
|
||||
response = requests.post(
|
||||
f"{self.base_url}/auth/token",
|
||||
headers={'Content-Type': 'application/json', 'User-Agent': self.user_store,'device_name': "A Python login app.By NRFF & Deepseek"}, # 添加自定义User-Agent
|
||||
headers={'Content-Type': 'application/json', 'User-Agent': self.user_store,"device_id":self.device_id}, # 添加自定义User-Agent
|
||||
data=json.dumps({
|
||||
'grant_type': 'authorization_code',
|
||||
'code': self.challenge['id'],
|
||||
@@ -201,7 +201,7 @@ class AuthClient:
|
||||
# 示例调用
|
||||
if __name__ == "__main__":
|
||||
auth_client = AuthClient(base_url='https://api.solian.app/id')
|
||||
account_identifier = ''#你的账号
|
||||
account_identifier = 'nanci'#你的账号
|
||||
selected_factor_id = "enter-code" # 用户需要选择一个因素
|
||||
password = ''#你的密码
|
||||
# 第一步:检查账户有效性
|
||||
|
Reference in New Issue
Block a user