import asyncio import httpx import time import logging from sdgb import MaimaiClient from settings import userId, musicData from payload import * maimai = MaimaiClient() logging.basicConfig( level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s' ) logger = logging.getLogger(__name__) async def run_workflow(self): async with httpx.AsyncClient(verify=False) as client: # Preview 探测 PreviewResponse = json.loads(await self.call_api(client, "GetUserPreviewApi", requestData_UserPreview, userId)) if PreviewResponse["isLogin"] == True: logger.error("已在他处登录。") return # UserLogin LoginResponse = json.loads(await self.call_api(client, "UserLoginApi", requestData_UserLogin, userId)) if LoginResponse["returnCode"] == 106: logger.error("chime verfication failed.") return loginId = LoginResponse['loginId'] loginDate = LoginResponse['lastLoginDate'] # User Charge await self.call_api(client, "UpsertUserChargelogApi", requestData_UserChargelog, userId) # UserLogout await self.call_api(client, "UserLogoutApi", requestData_UserLogout, userId) if __name__ == "__main__": asyncio.run(run_workflow(maimai))