first commit
This commit is contained in:
parent
8e58e24d2e
commit
973c47ff25
16 changed files with 866 additions and 0 deletions
24
accounts.py
Normal file
24
accounts.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
from logger import logger
|
||||
from typing import Optional,List,Dict,Any
|
||||
from config import Settings
|
||||
|
||||
def accounts_info(config: Settings) -> Optional[Dict[str, Any]]:
|
||||
if config is None:
|
||||
logger.error({"config_err": "config is null, can not get accounts"})
|
||||
return None
|
||||
return config.accounts
|
||||
|
||||
def accounts_list(config: Settings) -> Optional[List[str]]:
|
||||
info = accounts_info(config)
|
||||
|
||||
if info is None:
|
||||
logger.error({"config_account_err": "can not get accounts from config file"})
|
||||
return None
|
||||
|
||||
accounts=[]
|
||||
for account_id,value in info.items():
|
||||
if not value.get("session_id") or not value.get("cookie"):
|
||||
logger.error({"config_account_err": "account config error"})
|
||||
return {"config_account_err": "account config error"}
|
||||
accounts.append(account_id)
|
||||
return accounts
|
Loading…
Add table
Add a link
Reference in a new issue