bitmart优化完成
This commit is contained in:
Binary file not shown.
Binary file not shown.
BIN
telegram/sign.db
BIN
telegram/sign.db
Binary file not shown.
@@ -9,7 +9,7 @@ from tqdm import tqdm
|
||||
from loguru import logger
|
||||
from DrissionPage import ChromiumOptions, ChromiumPage
|
||||
from curl_cffi import requests
|
||||
|
||||
from bit_tools import openBrowser
|
||||
from 交易.tools import send_dingtalk_message
|
||||
|
||||
|
||||
@@ -92,20 +92,17 @@ class BrowserManager:
|
||||
self.tge_port: Optional[int] = None
|
||||
self.page: Optional[ChromiumPage] = None
|
||||
|
||||
def open_browser(self) -> bool:
|
||||
"""打开浏览器并获取端口"""
|
||||
def openBrowser(self):
|
||||
"""打开 TGE 对应浏览器实例"""
|
||||
try:
|
||||
response = requests.post(
|
||||
f"{self.tge_url}/api/browser/start",
|
||||
json={"envId": self.tge_id},
|
||||
headers=self.tge_headers,
|
||||
timeout=10
|
||||
)
|
||||
self.tge_port = response.json()["data"]["port"]
|
||||
logger.success(f"成功打开浏览器,端口:{self.tge_port}")
|
||||
bit_port = openBrowser(id=self.tge_id)
|
||||
co = ChromiumOptions()
|
||||
co.set_local_port(port=bit_port)
|
||||
self.page = ChromiumPage(addr_or_opts=co)
|
||||
|
||||
self.tge_port = bit_port
|
||||
return True
|
||||
except Exception as e:
|
||||
logger.error(f"打开浏览器失败: {e}")
|
||||
except:
|
||||
return False
|
||||
|
||||
def take_over_browser(self) -> bool:
|
||||
@@ -655,7 +652,7 @@ class TimeUtils:
|
||||
class WeexTransaction:
|
||||
"""WEEX自动交易主类"""
|
||||
|
||||
def __init__(self, tge_id: int):
|
||||
def __init__(self, tge_id):
|
||||
# 配置
|
||||
self.tge_id = tge_id
|
||||
self.tge_headers = {
|
||||
@@ -680,7 +677,7 @@ class WeexTransaction:
|
||||
def initialize(self) -> bool:
|
||||
"""初始化所有组件"""
|
||||
# 打开浏览器
|
||||
if not self.browser_manager.open_browser():
|
||||
if not self.browser_manager.openBrowser():
|
||||
logger.error("打开浏览器失败")
|
||||
MessageSender.send_dingtalk_message("打开浏览器失败", is_error=True)
|
||||
return False
|
||||
@@ -905,5 +902,5 @@ class WeexTransaction:
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
transaction = WeexTransaction(tge_id=146473)
|
||||
transaction = WeexTransaction(tge_id="86837a981aba4576be6916a0ef6ad785")
|
||||
transaction.action()
|
||||
|
||||
Reference in New Issue
Block a user