feat: userdata fetch
This commit is contained in:
@@ -149,6 +149,7 @@ def apiSDGB(
|
|||||||
|
|
||||||
# 处理响应内容
|
# 处理响应内容
|
||||||
responseContentRaw = response.content
|
responseContentRaw = response.content
|
||||||
|
print(list(responseContentRaw))
|
||||||
|
|
||||||
# 先尝试解密
|
# 先尝试解密
|
||||||
try:
|
try:
|
||||||
|
|||||||
30
GetUserData.py
Normal file
30
GetUserData.py
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# 获取用户简略预览数据的 API 实现,此 API 无需任何登录即可调取
|
||||||
|
|
||||||
|
from loguru import logger
|
||||||
|
import rapidjson as json
|
||||||
|
|
||||||
|
from API_TitleServer import apiSDGB
|
||||||
|
from HelperLogInOut import apiLogin, apiLogout, generateTimestamp
|
||||||
|
from MyConfig import testUid8
|
||||||
|
|
||||||
|
|
||||||
|
def apiGetUserData(userId, noLog: bool = False) -> str:
|
||||||
|
data = json.dumps({"userId": int(userId)})
|
||||||
|
preview_result = apiSDGB(data, "GetUserDataApi", userId, noLog)
|
||||||
|
return preview_result
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
userId = int(input("type user id: ").strip() or "0") or testUid8
|
||||||
|
currentLoginTimestamp = generateTimestamp()
|
||||||
|
loginResult = apiLogin(currentLoginTimestamp, userId)
|
||||||
|
|
||||||
|
if loginResult["returnCode"] != 1:
|
||||||
|
logger.info("登录失败")
|
||||||
|
exit()
|
||||||
|
try:
|
||||||
|
logger.info(apiGetUserData(userId, noLog=False))
|
||||||
|
logger.info(apiLogout(currentLoginTimestamp, userId))
|
||||||
|
finally:
|
||||||
|
logger.info(apiLogout(currentLoginTimestamp, userId))
|
||||||
|
# logger.warning("Error")
|
||||||
Reference in New Issue
Block a user