improve base config reading command line arg logic

This commit is contained in:
nelzomal
2024-06-09 18:51:36 +08:00
parent 3c7c678d7a
commit eace7d1750
15 changed files with 91 additions and 139 deletions
+4 -4
View File
@@ -24,7 +24,7 @@ class WeiboLogin(AbstractLogin):
login_phone: Optional[str] = "",
cookie_str: str = ""
):
self.login_type = login_type
config.LOGIN_TYPE = login_type
self.browser_context = browser_context
self.context_page = context_page
self.login_phone = login_phone
@@ -33,11 +33,11 @@ class WeiboLogin(AbstractLogin):
async def begin(self):
"""Start login weibo"""
utils.logger.info("[WeiboLogin.begin] Begin login weibo ...")
if self.login_type == "qrcode":
if config.LOGIN_TYPE == "qrcode":
await self.login_by_qrcode()
elif self.login_type == "phone":
elif config.LOGIN_TYPE == "phone":
await self.login_by_mobile()
elif self.login_type == "cookie":
elif config.LOGIN_TYPE == "cookie":
await self.login_by_cookies()
else:
raise ValueError(