|
...
|
...
|
@@ -77,34 +77,34 @@ class Monitor(callback.CallBack): |
|
|
|
cfunc = functools.partial(mfunc, client)
|
|
|
|
setattr(client, fname, cfunc)
|
|
|
|
|
|
|
|
def change(self, email, password, cookie=None):
|
|
|
|
limit = 100
|
|
|
|
if self.size >= limit:
|
|
|
|
raise Exception("单台终端登录到达上限,%d个号" % limit)
|
|
|
|
client = self._get_member(email)
|
|
|
|
if client:
|
|
|
|
self.onLoggedIn(client)
|
|
|
|
return client.info()
|
|
|
|
else:
|
|
|
|
try:
|
|
|
|
if email in self.change_list:
|
|
|
|
self.onChangEnv(email, 'changeError', f'{email}已经在登录队列中')
|
|
|
|
return
|
|
|
|
else:
|
|
|
|
self.change_list.append(email)
|
|
|
|
self.onChangEnv(email, 'waiting', '队列中...')
|
|
|
|
self.changeLock.acquire()
|
|
|
|
self.changeingIn(email) # 转环境的话清理缓存
|
|
|
|
result, email, password, cookie, user_agent = self.selenium_login(email, password, cookie)
|
|
|
|
if result:
|
|
|
|
self.onChangSucceed(email, '匹配设备指纹成功',
|
|
|
|
data={'email': email, 'password': password, 'cookie': cookie})
|
|
|
|
except Exception as err:
|
|
|
|
self.onChangEnv(email, 'changeError', str(err))
|
|
|
|
raise err
|
|
|
|
finally:
|
|
|
|
self.change_list.remove(email)
|
|
|
|
self.changeLock.release()
|
|
|
|
# def change(self, email, password, cookie=None):
|
|
|
|
# limit = 100
|
|
|
|
# if self.size >= limit:
|
|
|
|
# raise Exception("单台终端登录到达上限,%d个号" % limit)
|
|
|
|
# client = self._get_member(email)
|
|
|
|
# if client:
|
|
|
|
# self.onLoggedIn(client)
|
|
|
|
# return client.info()
|
|
|
|
# else:
|
|
|
|
# try:
|
|
|
|
# if email in self.change_list:
|
|
|
|
# self.onChangEnv(email, 'changeError', f'{email}已经在登录队列中')
|
|
|
|
# return
|
|
|
|
# else:
|
|
|
|
# self.change_list.append(email)
|
|
|
|
# self.onChangEnv(email, 'waiting', '队列中...')
|
|
|
|
# self.changeLock.acquire()
|
|
|
|
# self.changeingIn(email) # 转环境的话清理缓存
|
|
|
|
# result, email, password, cookie, user_agent = self.selenium_login(email, password, cookie)
|
|
|
|
# if result:
|
|
|
|
# self.onChangSucceed(email, '匹配设备指纹成功',
|
|
|
|
# data={'email': email, 'password': password, 'cookie': cookie})
|
|
|
|
# except Exception as err:
|
|
|
|
# self.onChangEnv(email, 'changeError', str(err))
|
|
|
|
# raise err
|
|
|
|
# finally:
|
|
|
|
# self.change_list.remove(email)
|
|
|
|
# self.changeLock.release()
|
|
|
|
|
|
|
|
def login(self, email, password, cookie=None, user_agent=None, proxy=None):
|
|
|
|
limit = 100
|
...
|
...
|
|