+ Update transfer speed
+ Add error handler for getting credit
This commit is contained in:
parent
d191821a6a
commit
3fb2786506
@ -178,6 +178,7 @@ class CM_BOT_HAL:
|
|||||||
return float(cm_bot.get_user_credit())
|
return float(cm_bot.get_user_credit())
|
||||||
|
|
||||||
def transfer_credit_api(self, f_username: str, f_password: str, t_username: str, t_password: str):
|
def transfer_credit_api(self, f_username: str, f_password: str, t_username: str, t_password: str):
|
||||||
|
try:
|
||||||
cm_bot = CM_BOT()
|
cm_bot = CM_BOT()
|
||||||
if cm_bot.login(
|
if cm_bot.login(
|
||||||
username = f_username,
|
username = f_username,
|
||||||
@ -191,7 +192,8 @@ class CM_BOT_HAL:
|
|||||||
return(f'Successfully transfer amount: {amount} from {f_username} to {t_username}')
|
return(f'Successfully transfer amount: {amount} from {f_username} to {t_username}')
|
||||||
else:
|
else:
|
||||||
return(f'Fail to transfer credit from {f_username} to {t_username}')
|
return(f'Fail to transfer credit from {f_username} to {t_username}')
|
||||||
|
except:
|
||||||
|
return(f'Fail transfer credit for {f_username}')
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
bot = CM_BOT_HAL()
|
bot = CM_BOT_HAL()
|
||||||
|
|||||||
@ -14,7 +14,7 @@ if not os.path.exists(logs_dir):
|
|||||||
|
|
||||||
# api_url = 'https://api.luckytown888.net'
|
# api_url = 'https://api.luckytown888.net'
|
||||||
api_url = 'http://api-server:3000'
|
api_url = 'http://api-server:3000'
|
||||||
max_threading = 10
|
max_threading = 20
|
||||||
|
|
||||||
def transfer(data: dict, local_logger):
|
def transfer(data: dict, local_logger):
|
||||||
bot = CM_BOT_HAL()
|
bot = CM_BOT_HAL()
|
||||||
@ -24,7 +24,7 @@ def transfer(data: dict, local_logger):
|
|||||||
local_logger.info(f"[Thread-{thread_name}] {result}")
|
local_logger.info(f"[Thread-{thread_name}] {result}")
|
||||||
local_logger.info(f"[Thread-{thread_name}] [Done] {data['f_username']} transfer done!")
|
local_logger.info(f"[Thread-{thread_name}] [Done] {data['f_username']} transfer done!")
|
||||||
del bot
|
del bot
|
||||||
time.sleep(10)
|
time.sleep(5)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
weekday = int(datetime.now().strftime("%w"))
|
weekday = int(datetime.now().strftime("%w"))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user