def pan(): from selenium import webdriver import path as p import json import re import time from bs4 import BeautifulSoup as bs #from pyquery import PyQuery as pq from selenium.webdriver.chrome.options import Options chrome_options =Options() chrome_options.add_argument('--headless') d = webdriver.Chrome(p.getpath()+"\\py\\lib\\chromedriver.exe",options=chrome_options) #d=webdriver.Chrome(p.getpath()+"\\py\\lib\\chromedriver.exe") d.get("http://pan.baidu.com") d.delete_all_cookies() with open(p.getpath()+"\\py\\lib\\setting.json") as f: j=json.load(f) c=j["cookie"] for i in range(len(c)): x=c[i] if "expiry" in x: x.pop("expiry") c[i]=x d.add_cookie(c[i]) d.get(r"http://pan.baidu.com/disk/home?#/all?path=%2F&vmode=list") time.sleep(1) try: element=d.find_element_by_class_name('know-button') element.click() except: pass pg=str(d.page_source) r=re.findall("<span node-type=\"wzMD72\" class=\"bold\">(.*?)</span>",pg)[0] j=re.findall("<span node-type=\"txiw1x01\">(.*?)</span>",pg)[0] return (r,j)
def start(): chrome_options = Options() chrome_options.add_argument('--headless') d = webdriver.Chrome(p.getpath() + "\\py\\lib\\chromedriver.exe", options=chrome_options) #d=webdriver.Chrome(p.getpath()+"\\py\\lib\\chromedriver.exe") d.get("http://pan.baidu.com") d.delete_all_cookies() with open(p.getpath() + "\\py\\lib\\setting.json") as f: j = json.load(f) c = j["cookie"] for i in range(len(c)): x = c[i] if "expiry" in x: x.pop("expiry") c[i] = x d.add_cookie(c[i]) d.get(r"http://pan.baidu.com/disk/home?#/all?path=%2F&vmode=list") while True: try: element = d.find_element_by_class_name('know-button') element.click() break except: pass
def retranslateUi(self, Dialog): def t(): title = "程序" + self.lineEdit.text() + "问题反馈" print(title) pmwq = "联系方式:" + self.lineEdit_2.text() print(pmwq) what = self.textEdit.toPlainText() print(what) if title == "" or pmwq == "" or what == "": class do(QWidget): def restart(): python = sys.executable os.execl(python, python, *sys.argv) def __init__(self): import sys app = QApplication(sys.argv) super().__init__() reply = QMessageBox.information( self, "不能提交", "不能有空项", QMessageBox.Ok) do.restart() do() else: mail.mail(t=title, c="问题:\n" + what + "\n" + pmwq) class do(QWidget): def __init__(self): with open(path.getpath() + "\\py\\lib\\tmp.json") as f: j = json.load(f) j["is"] = 0 with open(path.getpath() + "\\py\\lib\\tmp.json", "w") as f: json.dump(j, f) import sys app = QApplication(sys.argv) super().__init__() reply = QMessageBox.information( self, "反馈成功", "谢谢! ", QMessageBox.Ok) quit() do() with open(path.getpath() + "\\py\\lib\\tmp.json") as f: j = json.load(f) if j["is"]: self.textEdit.setText(j["text"]) print(j) _translate = QtCore.QCoreApplication.translate Dialog.setWindowTitle(_translate("Dialog", "反馈")) Dialog.setWindowIcon(QIcon(path.getpath() + r"\icon\Dx.ico")) self.label_3.setText(_translate("Dialog", "程序名")) self.label_4.setText(_translate("Dialog", "问题")) self.label_5.setText(_translate("Dialog", "联系方式")) self.label_2.setText(_translate("Dialog", "程序遇到问题了吗?请反馈吧!")) self.pushButton.setText(_translate("Dialog", "反馈")) self.pushButton.clicked.connect(t) self.label.setText(_translate("Dialog", "反馈"))
def __init__(self): with open(path.getpath() + "\\py\\lib\\tmp.json") as f: j = json.load(f) j["is"] = 0 with open(path.getpath() + "\\py\\lib\\tmp.json", "w") as f: json.dump(j, f) import sys app = QApplication(sys.argv) super().__init__() reply = QMessageBox.information( self, "反馈成功", "谢谢! ", QMessageBox.Ok) quit()
def retranslateUi(self, Dialog): global x import sys def rr(): with open(path.getpath()+"\\py\\lib\\tmp.json","w",encoding="ANSI") as f: json.dump({'is':1,"text":x},f) os.system("pythonw "+path.getpath()+"\\py\\lib\\tweet.py") sys.exit(0) _translate = QtCore.QCoreApplication.translate Dialog.setWindowTitle(_translate("Dialog", "错误!")) Dialog.setWindowIcon(QIcon(path.getpath()+r"\icon\Dx.ico")) self.pushButton.setText(_translate("Dialog", "反馈")) self.pushButton.clicked.connect(rr) self.label_4.setText(_translate("Dialog", "请将该错误信息反馈给作者,也许能帮助解决此问题")) self.label.setPixmap(QPixmap(path.getpath()+"\\icon\\error.ico")) self.label_3.setText(_translate("Dialog", "错误信息:")) self.label_2.setText(_translate("Dialog", "程序出错!\n")) self.textBrowser.setText(x)
def rr(): with open(path.getpath()+"\\py\\lib\\tmp.json","w",encoding="ANSI") as f: json.dump({'is':1,"text":x},f) os.system("pythonw "+path.getpath()+"\\py\\lib\\tweet.py") sys.exit(0)
from PIL import Image from PIL import ImageFont from PIL import ImageDraw import math from path import getpath path, apikey, discordkey = getpath() def vbuckdisplay(amount, text): font = ImageFont.truetype(path + "BurbankBigCondensed-Black.otf", 90) img = Image.open(path + 'vbuck.png') draw = ImageDraw.Draw(img) draw.text((275, 100), str(amount) + " vbucks".upper(), (255, 255, 255), font=font) draw.text((20, 300), str(text).upper(), (255, 255, 255), font=font) img.save(path + 'vbuckchanged.png') def dollardisplay(amount): font = ImageFont.truetype(path + "BurbankBigCondensed-Black.otf", 90) img = Image.open(path + 'dollar.png') draw = ImageDraw.Draw(img) draw.text((275, 100), str(amount) + " dollars".upper(), (43, 255, 75), font=font) img.save(path + 'dollarchanged.png')
# Copy Raw file xlsx from path import getpath import path import os # importing openpyxl module import openpyxl as xl # opening the source excel file filename =path.getpath() workbook_source = xl.load_workbook(filename) worksheet_source = workbook_source.worksheets[0] # opening the destination excel file filename1 ="out.xlsx" workbook_dest = xl.load_workbook(filename1) worksheet_dest = workbook_dest.active worksheet_dest = workbook_dest.worksheets[1] # calculate total number of rows and # columns in source excel file mr = worksheet_source.max_row mc = worksheet_source.max_column # copying the cell values from source # excel file to destination excel file for i in range (1, mr + 1): for j in range (1, mc + 1): # reading cell value from source excel file c = worksheet_source.cell(row = i, column = j) # writing the read value to destination excel file