From 2ef19cd3b39329f1ab52d1b7097bdc8a66a1760b Mon Sep 17 00:00:00 2001 From: zhangdongxu Date: Fri, 23 Feb 2024 10:33:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B7=A8=E9=87=8F=E7=AD=BE?= =?UTF-8?q?=E5=88=B0=E5=9B=BE=E7=89=87=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- juliang.py | 2 +- tencentcaptcha.py | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/juliang.py b/juliang.py index 3b38e83..e8040ce 100644 --- a/juliang.py +++ b/juliang.py @@ -18,9 +18,9 @@ from tencentcaptcha import EC from tencentcaptcha import Tencent import os - juliang_account = os.getenv("juliang_account").split('\n') + class Juliang_net(Tencent): """ Tencent的子类,完成set_info()函数 diff --git a/tencentcaptcha.py b/tencentcaptcha.py index b07f2c3..e1de0a6 100644 --- a/tencentcaptcha.py +++ b/tencentcaptcha.py @@ -17,6 +17,7 @@ import time import re import requests +import os from selenium import webdriver from selenium.webdriver import ActionChains from selenium.webdriver.common.by import By @@ -154,7 +155,13 @@ class Tencent: # print('【缺口识别】 {x}px'.format(x=x / 2)) # return x / 2 # return 0 - with open('E:/PycharmProjects/littlepythonsheep/bg.jpeg', 'rb') as f: + # 判断当前环境是windows还是linux + imul = '' + if os.name == 'nt': + imul = 'E:/PycharmProjects/littlepythonsheep/bg.jpeg' + elif os.name == 'posix': + imul = '/ql/scripts/root_littlepythonsheep/bg.jpeg' + with open(imul, 'rb') as f: base64_data = base64.b64encode(f.read()) b64 = base64_data.decode() data = {"username": "littlecow", "password": "littlecow", "typeid": 33, "image": b64}