This commit is contained in:
Administrator
2025-12-12 16:45:23 +08:00
parent 877b94a99d
commit 2d5f82c4ea
3 changed files with 24 additions and 20 deletions

Binary file not shown.

View File

@@ -42,6 +42,8 @@ class WeexTransaction:
self.session = requests.Session() # 接口请求对象
self.cookies = {}
def openBrowser(self, ): # 直接指定ID打开窗口也可以使用 createBrowser 方法返回的ID
try:
@@ -261,24 +263,20 @@ class WeexTransaction:
for i in range(3):
tab.get(url="https://derivatives.bitmart.com/zh-CN/futures/ETHUSDT")
res = tab.listen.wait()
self.headers = res.request.headers
self.cookies = {}
try:
res = tab.listen.wait(timeout=5)
self.headers = res.request.headers
for i in res.request.cookies:
self.cookies[i["name"]] = i["value"]
if self.cookies.get('accessKey'):
self.session.cookies.update(self.cookies)
self.session.headers.update(self.headers)
if self.cookies:
break
except:
time.sleep(1)
tab.close()
return True if self.cookies else False
@@ -376,7 +374,7 @@ class WeexTransaction:
self.pbar.refresh()
if current_minute not in [0, 1, 2, 3, 4, 5, 30, 31, 32, 33, 34]: # 判断是否是 新的30分钟了
# if current_minute not in range(60): # 判断是否是 新的30分钟了
# if current_minute not in range(60): # 判断是否是 新的30分钟了
time.sleep(10)
continue

View File

@@ -49,6 +49,8 @@ class WeexTransaction:
self.session = requests.Session() # 接口请求对象
self.headers = None
def get_now_time1(self):
timestamp = time.time()
local_time = time.localtime(timestamp)
@@ -259,17 +261,21 @@ class WeexTransaction:
for i in range(3):
tab.get(url="https://www.weeaxs.site/zh-CN/futures/ETH-USDT")
res = tab.listen.wait(timeout=15)
if res.request.headers.get("U-TOKEN"):
self.headers = res.request.headers
try:
res = tab.listen.wait(timeout=5)
if res.request.headers.get("U-TOKEN"):
if not self.headers:
self.session.headers.update(self.headers)
self.session.headers = res.request.headers
else:
self.session.headers["U-TOKEN"] = res.request.headers["U-TOKEN"]
tab.close()
return True
else:
tab.close()
return False
tab.close()
return True
except:
time.sleep(1)
tab.close()
return False
def get_position_status(self):
json_data = {
@@ -343,8 +349,8 @@ class WeexTransaction:
self.pbar.n = current_minute - 30
self.pbar.refresh()
if current_minute not in [0, 1, 2, 3, 4, 5, 30, 31, 32, 33, 34, 35]: # 判断是否是 新的30分钟了
# if current_minute not in range(60): # 判断是否是 新的30分钟了
# if current_minute not in [0, 1, 2, 3, 4, 5, 30, 31, 32, 33, 34, 35]: # 判断是否是 新的30分钟了
if current_minute not in range(60): # 判断是否是 新的30分钟了
time.sleep(10)
continue