chore: totally fix lint issues
This commit is contained in:
@@ -2,30 +2,40 @@ import sys
|
||||
import rapidjson as json
|
||||
|
||||
from PyQt6.QtWidgets import (
|
||||
QApplication, QMainWindow, QWidget, QVBoxLayout, QLineEdit, QTextEdit, QPushButton, QLabel, QHBoxLayout
|
||||
QApplication,
|
||||
QMainWindow,
|
||||
QWidget,
|
||||
QVBoxLayout,
|
||||
QLineEdit,
|
||||
QTextEdit,
|
||||
QPushButton,
|
||||
QLabel,
|
||||
QHBoxLayout,
|
||||
)
|
||||
from PyQt6.QtCore import Qt
|
||||
|
||||
# 将当前目录的父目录加入到 sys.path 中
|
||||
from pathlib import Path
|
||||
|
||||
current_dir = Path(__file__).resolve().parent
|
||||
parent_dir = current_dir.parent
|
||||
sys.path.append(str(parent_dir))
|
||||
|
||||
from API_TitleServer import *
|
||||
|
||||
def sendRequest(requestText:str, apiNameText:str, uid:int) -> str:
|
||||
|
||||
def sendRequest(requestText: str, apiNameText: str, uid: int) -> str:
|
||||
try:
|
||||
data = json.loads(requestText)
|
||||
data = json.dumps(data)
|
||||
except:
|
||||
except Exception:
|
||||
return "给出的输入不是有效的 JSON"
|
||||
try:
|
||||
result = apiSDGB(data, apiNameText, uid)
|
||||
except Exception as e:
|
||||
return "请求失败:" + str(e)
|
||||
return result
|
||||
|
||||
|
||||
|
||||
class ApiTester(QMainWindow):
|
||||
def __init__(self):
|
||||
@@ -70,21 +80,18 @@ class ApiTester(QMainWindow):
|
||||
self.ResponseTextBox.setReadOnly(True)
|
||||
MainLayout.addWidget(self.ResponseTextBox)
|
||||
|
||||
|
||||
|
||||
# 布局设定
|
||||
MainLayout.setContentsMargins(5, 5, 5, 5)
|
||||
MainLayout.setSpacing(5)
|
||||
MainLayout.setAlignment(Qt.AlignmentFlag.AlignTop)
|
||||
|
||||
|
||||
def prepareRequest(self):
|
||||
# 发送请求用
|
||||
try:
|
||||
RequestDataString = self.RequestInputBox.toPlainText()
|
||||
TargetAPIString = self.TargetAPIInputBox.text()
|
||||
AgentExtraString = int(self.AgentExtraInputBox.text())
|
||||
except:
|
||||
except Exception:
|
||||
self.ResponseTextBox.setPlainText("输入无效")
|
||||
return
|
||||
|
||||
@@ -93,12 +100,13 @@ class ApiTester(QMainWindow):
|
||||
# 显示出输出
|
||||
self.ResponseTextBox.setPlainText(Result)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = QApplication(sys.argv)
|
||||
# Set proper style for each OS
|
||||
#if sys.platform == "win32":
|
||||
# if sys.platform == "win32":
|
||||
# app.setStyle("windowsvista")
|
||||
#else:
|
||||
# else:
|
||||
# app.setStyle("Fusion")
|
||||
window = ApiTester()
|
||||
window.show()
|
||||
|
||||
Reference in New Issue
Block a user