UPLOAD MAIN CODE OF APPLICATION
This commit is contained in:
commit
3cb23114ab
BIN
Failed.png
Normal file
BIN
Failed.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 232 B |
BIN
Sended.png
Normal file
BIN
Sended.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 255 B |
BIN
Sending.png
Normal file
BIN
Sending.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 262 B |
240
app.py
Normal file
240
app.py
Normal file
@ -0,0 +1,240 @@
|
|||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
from PyQt5.QtWidgets import *
|
||||||
|
from PyQt5.Qt import *
|
||||||
|
from threading import Thread
|
||||||
|
import mainwindow
|
||||||
|
from vk_api.bot_longpoll import VkBotLongPoll, VkBotEventType
|
||||||
|
|
||||||
|
import json, requests, os, random, pyperclip, traceback, vk_api
|
||||||
|
|
||||||
|
history_requests = list()
|
||||||
|
request_status = list()
|
||||||
|
|
||||||
|
|
||||||
|
def genToken(lenght=32, dictonary='0123456789abcdef'):
|
||||||
|
TOKEN = ''
|
||||||
|
for _ in range(lenght):
|
||||||
|
TOKEN += dictonary[random.randint(0, len(dictonary) - 1)]
|
||||||
|
return TOKEN
|
||||||
|
|
||||||
|
|
||||||
|
class callback_clientException(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class callback_server(Thread):
|
||||||
|
def connect(self, group_id, server_url, secret_key, ret_str, ACCESS_TOKEN):
|
||||||
|
global history_requests, request_status
|
||||||
|
|
||||||
|
self.runned = False
|
||||||
|
try:
|
||||||
|
vk_session = vk_api.VkApi(token=ACCESS_TOKEN)
|
||||||
|
vk = vk_session.get_api()
|
||||||
|
self.longpoll = VkBotLongPoll(vk_session, group_id)
|
||||||
|
except:
|
||||||
|
print(traceback.format_exc())
|
||||||
|
raise callback_clientException('Invalid session info')
|
||||||
|
|
||||||
|
r_body = {
|
||||||
|
"type": "confirmation",
|
||||||
|
"group_id": group_id,
|
||||||
|
"event_id": genToken(40),
|
||||||
|
"secret": secret_key
|
||||||
|
}
|
||||||
|
request_status.append(0)
|
||||||
|
history_requests.append(r_body)
|
||||||
|
r = requests.post(server_url, json=r_body)
|
||||||
|
if r.text != ret_str:
|
||||||
|
request_status[request_status.index(r_body)] = -1
|
||||||
|
raise callback_clientException('Invalid response code')
|
||||||
|
else:
|
||||||
|
request_status[history_requests.index(r_body)] = 1
|
||||||
|
self.group_id = group_id
|
||||||
|
self.secret_key = secret_key
|
||||||
|
self.ret_str = ret_str
|
||||||
|
self.server_url = server_url
|
||||||
|
self.runned = True
|
||||||
|
self.start()
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
global history_requests, request_status
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
for event in self.longpoll.listen():
|
||||||
|
|
||||||
|
if not(self.runned):
|
||||||
|
break
|
||||||
|
if 'obj' in dir(event):
|
||||||
|
r_body = {
|
||||||
|
"type": event.type.name.lower(),
|
||||||
|
"object": dict(event.object),
|
||||||
|
"group_id": self.group_id,
|
||||||
|
"event_id": genToken(40),
|
||||||
|
"secret": self.secret_key
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
r_body = {
|
||||||
|
"type": event.name.lower(),
|
||||||
|
"group_id": self.group_id,
|
||||||
|
"event_id": genToken(40),
|
||||||
|
"secret": self.secret_key
|
||||||
|
}
|
||||||
|
request_status.append(0)
|
||||||
|
history_requests.append(r_body)
|
||||||
|
try:
|
||||||
|
r = requests.post(self.server_url, json=r_body)
|
||||||
|
if r.text != 'ok':
|
||||||
|
request_status[history_requests.index(r_body)] = -1
|
||||||
|
else:
|
||||||
|
request_status[history_requests.index(r_body)] = 1
|
||||||
|
except:
|
||||||
|
request_status[history_requests.index(r_body)] = -1
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
if not(self.runned):
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
|
def filtrating_integer(string: str):
|
||||||
|
ret_str = ''
|
||||||
|
for symbol in string:
|
||||||
|
if symbol in '1234567890':
|
||||||
|
ret_str += symbol
|
||||||
|
return ret_str
|
||||||
|
|
||||||
|
|
||||||
|
class app_win(QMainWindow):
|
||||||
|
def __init__(self, app):
|
||||||
|
global history_requests
|
||||||
|
super(app_win, self).__init__()
|
||||||
|
self.ui = mainwindow.Ui_Form()
|
||||||
|
self.ui.setupUi(self)
|
||||||
|
self.setMouseTracking(True)
|
||||||
|
self.callback_server = callback_server()
|
||||||
|
|
||||||
|
# Other
|
||||||
|
retStr_file = open('ret_str.txt', 'r', encoding='utf-8')
|
||||||
|
self.ret_str = retStr_file.read()
|
||||||
|
self.connected = False
|
||||||
|
retStr_file.close()
|
||||||
|
del retStr_file
|
||||||
|
if not(self.ret_str):
|
||||||
|
self.ret_str = genToken(8)
|
||||||
|
retStr_file = open('ret_str.txt', 'wt', encoding='utf-8')
|
||||||
|
retStr_file.write(self.ret_str)
|
||||||
|
retStr_file.close()
|
||||||
|
del retStr_file
|
||||||
|
self.ui.ret_str.setText(f"Строка, которую должен вернуть сервер: {self.ret_str}")
|
||||||
|
self.parsed_requests = list()
|
||||||
|
self.parsed_responses = list()
|
||||||
|
# Вызов старых данных
|
||||||
|
secret_keyFile = open('secret_key.txt', 'r', encoding='utf-8')
|
||||||
|
self.ui.secret_key.setText(secret_keyFile.read())
|
||||||
|
tokenFile = open('token.txt', 'r', encoding='utf-8')
|
||||||
|
self.ui.group_token.setText(tokenFile.read())
|
||||||
|
group_idFile = open('group_id.txt', 'r', encoding='utf-8')
|
||||||
|
self.ui.group_idInput.setText(group_idFile.read())
|
||||||
|
server_urlFile = open('server_url.txt', 'r', encoding='utf-8')
|
||||||
|
self.ui.server_url.setText(server_urlFile.read())
|
||||||
|
|
||||||
|
secret_keyFile.close()
|
||||||
|
tokenFile.close()
|
||||||
|
group_idFile.close()
|
||||||
|
server_urlFile.close()
|
||||||
|
|
||||||
|
self.qtimer = QTimer()
|
||||||
|
self.qtimer.timeout.connect(self.qTimer_void)
|
||||||
|
self.qtimer.start(1)
|
||||||
|
|
||||||
|
self.show()
|
||||||
|
self.json_code_view = ''
|
||||||
|
# Button's functions
|
||||||
|
self.ui.copy_ret_str.clicked.connect(lambda: pyperclip.copy(self.ret_str))
|
||||||
|
self.ui.gen_ret_str.clicked.connect(self.generate_returnString)
|
||||||
|
self.ui.start.clicked.connect(self.connect_callback)
|
||||||
|
|
||||||
|
def update_info_requests(self):
|
||||||
|
global history_requests, request_status
|
||||||
|
self.ui.requestsWidget.clear()
|
||||||
|
for request in history_requests:
|
||||||
|
r_status = request_status[history_requests.index(request)]
|
||||||
|
item = QtWidgets.QListWidgetItem(request['type'])
|
||||||
|
icon = QtGui.QIcon()
|
||||||
|
if r_status == -1:
|
||||||
|
icon.addPixmap(QtGui.QPixmap(":/response_codes/Failed.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
|
elif r_status == 1:
|
||||||
|
icon.addPixmap(QtGui.QPixmap(":/response_codes/Sended.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
|
elif r_status == 0:
|
||||||
|
icon.addPixmap(QtGui.QPixmap(":/response_codes/Sending.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
|
item.setIcon(icon)
|
||||||
|
self.ui.requestsWidget.addItem(item)
|
||||||
|
|
||||||
|
def qTimer_void(self):
|
||||||
|
global history_requests, request_status
|
||||||
|
self.ui.start.setEnabled(bool(self.ui.server_url.text()) and bool(self.ui.group_idInput.text()) and bool(self.ui.group_token.text()) and not(self.connected))
|
||||||
|
if self.parsed_requests != history_requests or self.parsed_responses != request_status:
|
||||||
|
self.update_info_requests()
|
||||||
|
self.parsed_requests = history_requests.copy()
|
||||||
|
self.parsed_responses = request_status.copy()
|
||||||
|
if self.ui.requestsWidget.currentRow() != -1:
|
||||||
|
JSON_CONTENT = history_requests[self.ui.requestsWidget.currentRow()]
|
||||||
|
JSON_CONTENT = json.dumps(JSON_CONTENT, ensure_ascii=False, indent=4)
|
||||||
|
if self.json_code_view != JSON_CONTENT:
|
||||||
|
self.json_code_view = JSON_CONTENT
|
||||||
|
self.ui.requestBody.setText(self.json_code_view)
|
||||||
|
if self.ui.group_idInput.text() != filtrating_integer(self.ui.group_idInput.text()):
|
||||||
|
self.ui.group_idInput.setText(filtrating_integer(self.ui.group_idInput.text()))
|
||||||
|
|
||||||
|
def connect_callback(self):
|
||||||
|
try:
|
||||||
|
if bool(self.ui.secret_key.text()):
|
||||||
|
secret_key = self.ui.secret_key.text()
|
||||||
|
else:
|
||||||
|
secret_key = 'aaQ13axAPQEcczQa'
|
||||||
|
self.callback_server.connect(
|
||||||
|
group_id=int(self.ui.group_idInput.text()),
|
||||||
|
server_url=self.ui.server_url.text(),
|
||||||
|
secret_key=secret_key,
|
||||||
|
ret_str=self.ret_str,
|
||||||
|
ACCESS_TOKEN=self.ui.group_token.text()
|
||||||
|
)
|
||||||
|
# Записать данные
|
||||||
|
secret_keyFile = open('secret_key.txt', 'wt', encoding='utf-8')
|
||||||
|
secret_keyFile.write(self.ui.secret_key.text())
|
||||||
|
tokenFile = open('token.txt', 'wt', encoding='utf-8')
|
||||||
|
tokenFile.write(self.ui.group_token.text())
|
||||||
|
group_idFile = open('group_id.txt', 'wt', encoding='utf-8')
|
||||||
|
group_idFile.write(self.ui.group_idInput.text())
|
||||||
|
server_urlFile = open('server_url.txt', 'wt', encoding='utf-8')
|
||||||
|
server_urlFile.write(self.ui.server_url.text())
|
||||||
|
|
||||||
|
secret_keyFile.close()
|
||||||
|
tokenFile.close()
|
||||||
|
group_idFile.close()
|
||||||
|
server_urlFile.close()
|
||||||
|
|
||||||
|
self.connected = True
|
||||||
|
self.ui.work_status.setText("<html><head/><body><p><img src=\":/response_codes/Sended.png\"/> Сервер запущен!</p></body></html>")
|
||||||
|
QMessageBox.information(self, 'Успех!', "Сервер подключён", QMessageBox.Ok)
|
||||||
|
except Exception as exc:
|
||||||
|
if 'session info' in str(exc):
|
||||||
|
QMessageBox.critical(self, 'Блять!', "Неверный ключ сесии", QMessageBox.Ok)
|
||||||
|
elif 'response code' in str(exc):
|
||||||
|
QMessageBox.critical(self, 'Блять!', "Сервер вернул не ту строку", QMessageBox.Ok)
|
||||||
|
else:
|
||||||
|
print(traceback.format_exc())
|
||||||
|
QMessageBox.critical(self, 'Блять!', str(exc), QMessageBox.Ok)
|
||||||
|
|
||||||
|
def generate_returnString(self):
|
||||||
|
self.ret_str = genToken(8)
|
||||||
|
retStr_file = open('ret_str.txt', 'wt', encoding='utf-8')
|
||||||
|
retStr_file.write(self.ret_str)
|
||||||
|
retStr_file.close()
|
||||||
|
self.ui.ret_str.setText(f"Строка, которую должен вернуть сервер: {self.ret_str}")
|
||||||
|
|
||||||
|
|
||||||
|
app = QApplication([])
|
||||||
|
|
||||||
|
application = app_win(app)
|
||||||
|
app.exec()
|
||||||
|
os.abort()
|
1
group_id.txt
Normal file
1
group_id.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
205047099
|
244
main.ui
Normal file
244
main.ui
Normal file
@ -0,0 +1,244 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>Form</class>
|
||||||
|
<widget class="QWidget" name="Form">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>631</width>
|
||||||
|
<height>557</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>631</width>
|
||||||
|
<height>557</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>631</width>
|
||||||
|
<height>557</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Генератор callback запросов</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QGroupBox" name="groupBox">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>10</y>
|
||||||
|
<width>601</width>
|
||||||
|
<height>151</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>Информация о сервере</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QLineEdit" name="server_url">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>20</x>
|
||||||
|
<y>30</y>
|
||||||
|
<width>261</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>url сервера</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>20</x>
|
||||||
|
<y>50</y>
|
||||||
|
<width>251</width>
|
||||||
|
<height>16</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Секретный ключ</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="secret_key">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>20</x>
|
||||||
|
<y>70</y>
|
||||||
|
<width>261</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>aaQ13axAPQEcczQa</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="ret_str">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>290</x>
|
||||||
|
<y>30</y>
|
||||||
|
<width>301</width>
|
||||||
|
<height>41</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Строка, которую должен вернуть сервер: XXXXXXX</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="copy_ret_str">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>504</x>
|
||||||
|
<y>80</y>
|
||||||
|
<width>91</width>
|
||||||
|
<height>23</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="cursor">
|
||||||
|
<cursorShape>PointingHandCursor</cursorShape>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Скопировать</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="gen_ret_str">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>410</x>
|
||||||
|
<y>80</y>
|
||||||
|
<width>91</width>
|
||||||
|
<height>23</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="cursor">
|
||||||
|
<cursorShape>PointingHandCursor</cursorShape>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Сгенерировать</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="group_token">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>20</x>
|
||||||
|
<y>120</y>
|
||||||
|
<width>261</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="echoMode">
|
||||||
|
<enum>QLineEdit::Password</enum>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>токен группы</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="group_idInput">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>20</x>
|
||||||
|
<y>100</y>
|
||||||
|
<width>261</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>id группы</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="start">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>530</x>
|
||||||
|
<y>520</y>
|
||||||
|
<width>75</width>
|
||||||
|
<height>23</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="cursor">
|
||||||
|
<cursorShape>PointingHandCursor</cursorShape>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Запуск</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>160</y>
|
||||||
|
<width>311</width>
|
||||||
|
<height>21</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p align="center">Запросы</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QListWidget" name="requestsWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>180</y>
|
||||||
|
<width>311</width>
|
||||||
|
<height>331</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QTextBrowser" name="requestBody">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>320</x>
|
||||||
|
<y>180</y>
|
||||||
|
<width>291</width>
|
||||||
|
<height>331</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="cursor" stdset="0">
|
||||||
|
<cursorShape>IBeamCursor</cursorShape>
|
||||||
|
</property>
|
||||||
|
<property name="html">
|
||||||
|
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
|
p, li { white-space: pre-wrap; }
|
||||||
|
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||||
|
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>320</x>
|
||||||
|
<y>160</y>
|
||||||
|
<width>291</width>
|
||||||
|
<height>21</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p align="center">Тело запроса</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="work_status">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>406</x>
|
||||||
|
<y>520</y>
|
||||||
|
<width>121</width>
|
||||||
|
<height>21</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p><img src=":/response_codes/Sending.png"/> Сервер не запущен</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="source.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
95
mainwindow.py
Normal file
95
mainwindow.py
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Form implementation generated from reading ui file 'main.ui'
|
||||||
|
#
|
||||||
|
# Created by: PyQt5 UI code generator 5.15.2
|
||||||
|
#
|
||||||
|
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
||||||
|
# run again. Do not edit this file unless you know what you are doing.
|
||||||
|
|
||||||
|
|
||||||
|
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||||
|
|
||||||
|
|
||||||
|
class Ui_Form(object):
|
||||||
|
def setupUi(self, Form):
|
||||||
|
Form.setObjectName("Form")
|
||||||
|
Form.resize(631, 557)
|
||||||
|
Form.setMinimumSize(QtCore.QSize(631, 557))
|
||||||
|
Form.setMaximumSize(QtCore.QSize(631, 557))
|
||||||
|
self.groupBox = QtWidgets.QGroupBox(Form)
|
||||||
|
self.groupBox.setGeometry(QtCore.QRect(10, 10, 601, 151))
|
||||||
|
self.groupBox.setObjectName("groupBox")
|
||||||
|
self.server_url = QtWidgets.QLineEdit(self.groupBox)
|
||||||
|
self.server_url.setGeometry(QtCore.QRect(20, 30, 261, 20))
|
||||||
|
self.server_url.setObjectName("server_url")
|
||||||
|
self.label = QtWidgets.QLabel(self.groupBox)
|
||||||
|
self.label.setGeometry(QtCore.QRect(20, 50, 251, 16))
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.secret_key = QtWidgets.QLineEdit(self.groupBox)
|
||||||
|
self.secret_key.setGeometry(QtCore.QRect(20, 70, 261, 20))
|
||||||
|
self.secret_key.setObjectName("secret_key")
|
||||||
|
self.ret_str = QtWidgets.QLabel(self.groupBox)
|
||||||
|
self.ret_str.setGeometry(QtCore.QRect(290, 30, 301, 41))
|
||||||
|
self.ret_str.setObjectName("ret_str")
|
||||||
|
self.copy_ret_str = QtWidgets.QPushButton(self.groupBox)
|
||||||
|
self.copy_ret_str.setGeometry(QtCore.QRect(504, 80, 91, 23))
|
||||||
|
self.copy_ret_str.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
|
||||||
|
self.copy_ret_str.setObjectName("copy_ret_str")
|
||||||
|
self.gen_ret_str = QtWidgets.QPushButton(self.groupBox)
|
||||||
|
self.gen_ret_str.setGeometry(QtCore.QRect(410, 80, 91, 23))
|
||||||
|
self.gen_ret_str.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
|
||||||
|
self.gen_ret_str.setObjectName("gen_ret_str")
|
||||||
|
self.group_token = QtWidgets.QLineEdit(self.groupBox)
|
||||||
|
self.group_token.setGeometry(QtCore.QRect(20, 120, 261, 20))
|
||||||
|
self.group_token.setEchoMode(QtWidgets.QLineEdit.Password)
|
||||||
|
self.group_token.setObjectName("group_token")
|
||||||
|
self.group_idInput = QtWidgets.QLineEdit(self.groupBox)
|
||||||
|
self.group_idInput.setGeometry(QtCore.QRect(20, 100, 261, 20))
|
||||||
|
self.group_idInput.setObjectName("group_idInput")
|
||||||
|
self.start = QtWidgets.QPushButton(Form)
|
||||||
|
self.start.setGeometry(QtCore.QRect(530, 520, 75, 23))
|
||||||
|
self.start.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
|
||||||
|
self.start.setObjectName("start")
|
||||||
|
self.label_2 = QtWidgets.QLabel(Form)
|
||||||
|
self.label_2.setGeometry(QtCore.QRect(10, 160, 311, 21))
|
||||||
|
self.label_2.setObjectName("label_2")
|
||||||
|
self.requestsWidget = QtWidgets.QListWidget(Form)
|
||||||
|
self.requestsWidget.setGeometry(QtCore.QRect(10, 180, 311, 331))
|
||||||
|
self.requestsWidget.setObjectName("requestsWidget")
|
||||||
|
self.requestBody = QtWidgets.QTextBrowser(Form)
|
||||||
|
self.requestBody.setGeometry(QtCore.QRect(320, 180, 291, 331))
|
||||||
|
self.requestBody.viewport().setProperty("cursor", QtGui.QCursor(QtCore.Qt.IBeamCursor))
|
||||||
|
self.requestBody.setObjectName("requestBody")
|
||||||
|
self.label_3 = QtWidgets.QLabel(Form)
|
||||||
|
self.label_3.setGeometry(QtCore.QRect(320, 160, 291, 21))
|
||||||
|
self.label_3.setObjectName("label_3")
|
||||||
|
self.work_status = QtWidgets.QLabel(Form)
|
||||||
|
self.work_status.setGeometry(QtCore.QRect(406, 520, 121, 21))
|
||||||
|
self.work_status.setObjectName("work_status")
|
||||||
|
|
||||||
|
self.retranslateUi(Form)
|
||||||
|
QtCore.QMetaObject.connectSlotsByName(Form)
|
||||||
|
|
||||||
|
def retranslateUi(self, Form):
|
||||||
|
_translate = QtCore.QCoreApplication.translate
|
||||||
|
Form.setWindowTitle(_translate("Form", "Генератор callback запросов"))
|
||||||
|
self.groupBox.setTitle(_translate("Form", "Информация о сервере"))
|
||||||
|
self.server_url.setPlaceholderText(_translate("Form", "url сервера"))
|
||||||
|
self.label.setText(_translate("Form", "Секретный ключ"))
|
||||||
|
self.secret_key.setPlaceholderText(_translate("Form", "aaQ13axAPQEcczQa"))
|
||||||
|
self.ret_str.setText(_translate("Form", "Строка, которую должен вернуть сервер: XXXXXXX"))
|
||||||
|
self.copy_ret_str.setText(_translate("Form", "Скопировать"))
|
||||||
|
self.gen_ret_str.setText(_translate("Form", "Сгенерировать"))
|
||||||
|
self.group_token.setPlaceholderText(_translate("Form", "токен группы"))
|
||||||
|
self.group_idInput.setPlaceholderText(_translate("Form", "id группы"))
|
||||||
|
self.start.setText(_translate("Form", "Запуск"))
|
||||||
|
self.label_2.setText(_translate("Form", "<html><head/><body><p align=\"center\">Запросы</p></body></html>"))
|
||||||
|
self.requestBody.setHtml(_translate("Form", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||||
|
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
|
||||||
|
"p, li { white-space: pre-wrap; }\n"
|
||||||
|
"</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
|
||||||
|
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p></body></html>"))
|
||||||
|
self.label_3.setText(_translate("Form", "<html><head/><body><p align=\"center\">Тело запроса</p></body></html>"))
|
||||||
|
self.work_status.setText(_translate("Form", "<html><head/><body><p><img src=\":/response_codes/Sending.png\"/> Сервер не запущен</p></body></html>"))
|
||||||
|
import source_rc
|
1
ret_str.txt
Normal file
1
ret_str.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
bdacf402
|
1
secret_key.txt
Normal file
1
secret_key.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
87192jsahdjihasd2893eksadjkl
|
1
server_url.txt
Normal file
1
server_url.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
http://localhost:8989/205047099
|
7
source.qrc
Normal file
7
source.qrc
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<RCC>
|
||||||
|
<qresource prefix="response_codes">
|
||||||
|
<file>Failed.png</file>
|
||||||
|
<file>Sended.png</file>
|
||||||
|
<file>Sending.png</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
122
source_rc.py
Normal file
122
source_rc.py
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Resource object code
|
||||||
|
#
|
||||||
|
# Created by: The Resource Compiler for PyQt5 (Qt v5.15.2)
|
||||||
|
#
|
||||||
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
|
||||||
|
from PyQt5 import QtCore
|
||||||
|
|
||||||
|
qt_resource_data = b"\
|
||||||
|
\x00\x00\x00\xff\
|
||||||
|
\x89\
|
||||||
|
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
|
||||||
|
\x00\x00\x08\x00\x00\x00\x08\x08\x06\x00\x00\x00\xc4\x0f\xbe\x8b\
|
||||||
|
\x00\x00\x00\x01\x73\x52\x47\x42\x00\xae\xce\x1c\xe9\x00\x00\x00\
|
||||||
|
\x04\x67\x41\x4d\x41\x00\x00\xb1\x8f\x0b\xfc\x61\x05\x00\x00\x00\
|
||||||
|
\x09\x70\x48\x59\x73\x00\x00\x0e\xc3\x00\x00\x0e\xc3\x01\xc7\x6f\
|
||||||
|
\xa8\x64\x00\x00\x00\x94\x49\x44\x41\x54\x28\x53\x6d\x8f\x3b\x0e\
|
||||||
|
\xc2\x40\x0c\x44\x5f\x12\x3e\xca\x1f\x89\x88\xe3\xe4\x06\x94\x70\
|
||||||
|
\x08\xce\xc1\x01\xe8\xe9\x69\x29\xb9\x16\x45\x10\x20\x42\x16\xdb\
|
||||||
|
\xc9\x6a\x1b\xa6\xf0\x4a\x9e\xb7\x63\x3b\x22\xc8\x4d\xaf\x97\x79\
|
||||||
|
\x1e\x70\xed\x1e\xd2\x02\x66\x73\x18\x06\xb8\x9d\xad\x1f\x29\xe0\
|
||||||
|
\xda\x1d\x94\x6b\x28\x6a\x48\x04\x70\x92\xf5\x7a\xc0\xf5\x04\xb1\
|
||||||
|
\x62\xcb\x4c\x7e\xe7\x90\x0b\xb0\xda\x40\x25\x70\x56\xa9\x33\x01\
|
||||||
|
\x71\x32\x46\x2b\x58\x37\x61\x94\x79\x5a\x34\x52\xe7\x7e\xde\xd0\
|
||||||
|
\xdd\xe1\xd9\xc1\xb7\x37\x3f\x2c\xb9\x3d\x48\x6c\x09\x8b\x74\x34\
|
||||||
|
\x2f\x47\xeb\xdb\x92\x5e\x7f\xce\x84\x1f\x68\x93\x1f\xbf\xf3\x27\
|
||||||
|
\x8a\x50\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82\
|
||||||
|
\x00\x00\x01\x06\
|
||||||
|
\x89\
|
||||||
|
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
|
||||||
|
\x00\x00\x08\x00\x00\x00\x08\x08\x06\x00\x00\x00\xc4\x0f\xbe\x8b\
|
||||||
|
\x00\x00\x00\x01\x73\x52\x47\x42\x00\xae\xce\x1c\xe9\x00\x00\x00\
|
||||||
|
\x04\x67\x41\x4d\x41\x00\x00\xb1\x8f\x0b\xfc\x61\x05\x00\x00\x00\
|
||||||
|
\x09\x70\x48\x59\x73\x00\x00\x0e\xc3\x00\x00\x0e\xc3\x01\xc7\x6f\
|
||||||
|
\xa8\x64\x00\x00\x00\x9b\x49\x44\x41\x54\x28\x53\x6d\x8f\x31\x0e\
|
||||||
|
\x82\x50\x10\x44\x1f\x6a\x84\xc4\x00\x01\x31\x5a\x48\xe3\x5d\xbc\
|
||||||
|
\x83\xb5\x95\x85\x36\x9e\x00\x1b\xae\xe1\xf5\x2c\x0c\x46\x0b\x63\
|
||||||
|
\x04\xf2\xdd\xbf\xf0\x43\xe3\x34\x9b\xcc\xbc\xcc\xee\x7a\x0c\x32\
|
||||||
|
\xfd\x74\xd2\xcc\x01\xe6\x72\x82\x34\x86\xc0\x87\xb6\x85\x43\xa1\
|
||||||
|
\xbe\x67\x01\x53\x1c\x61\xbd\x82\xe5\x1c\xfc\xa9\x18\xd2\xf5\x78\
|
||||||
|
\xc1\xee\x0c\x23\x8b\xc5\x21\x24\x91\x00\x19\x6c\xf2\x0e\x5e\xa4\
|
||||||
|
\x36\xe9\x81\xc9\xb8\xab\x8e\x66\x90\x4b\xa8\xab\xa4\xc9\x4a\x01\
|
||||||
|
\x5b\xd9\x34\xf0\xfe\xc0\xed\x0e\xd5\x13\xbe\xb5\xe6\xc3\x91\xd7\
|
||||||
|
\x12\xb2\x04\x42\x69\xa9\x05\xde\xee\xd5\xd7\x23\x9d\xfe\xbc\x09\
|
||||||
|
\x3f\xc4\x1d\x20\x2a\x30\x28\x84\x9b\x00\x00\x00\x00\x49\x45\x4e\
|
||||||
|
\x44\xae\x42\x60\x82\
|
||||||
|
\x00\x00\x00\xe8\
|
||||||
|
\x89\
|
||||||
|
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\
|
||||||
|
\x00\x00\x08\x00\x00\x00\x08\x08\x06\x00\x00\x00\xc4\x0f\xbe\x8b\
|
||||||
|
\x00\x00\x00\x01\x73\x52\x47\x42\x00\xae\xce\x1c\xe9\x00\x00\x00\
|
||||||
|
\x04\x67\x41\x4d\x41\x00\x00\xb1\x8f\x0b\xfc\x61\x05\x00\x00\x00\
|
||||||
|
\x09\x70\x48\x59\x73\x00\x00\x0e\xc3\x00\x00\x0e\xc3\x01\xc7\x6f\
|
||||||
|
\xa8\x64\x00\x00\x00\x7d\x49\x44\x41\x54\x28\x53\x6d\xcf\x4b\x0e\
|
||||||
|
\x82\x30\x14\x85\xe1\xd6\x98\xe0\x44\x8c\x04\xc3\x44\x27\xee\x85\
|
||||||
|
\x3d\xb8\x04\x97\x21\x2b\x61\x7b\x8c\x60\xc6\x80\x47\xca\x7f\x6e\
|
||||||
|
\xb8\x3a\xf1\x24\xdf\x25\x69\x4f\xda\x12\xc3\x2f\x69\xff\x7a\x6c\
|
||||||
|
\xcf\x0b\xa9\x61\x14\x38\x61\xc5\x1b\x24\xaa\x90\x3e\x8c\x3b\x2a\
|
||||||
|
\x64\x5a\xc0\x80\x17\x0e\x08\x17\x5c\xa1\xc2\x13\x2a\xdf\xa0\x58\
|
||||||
|
\xe1\x08\x1d\x9d\xe3\x01\xbf\x4a\xb1\x82\x8e\x5c\x30\xa2\x43\x8f\
|
||||||
|
\x09\xca\xf7\x91\x2d\xa3\xc4\x19\x33\x6a\x10\x7b\xa4\xe7\xcf\x6f\
|
||||||
|
\x86\xb0\x01\x6c\x66\x12\xa7\x5a\x04\x9e\xc1\x00\x00\x00\x00\x49\
|
||||||
|
\x45\x4e\x44\xae\x42\x60\x82\
|
||||||
|
"
|
||||||
|
|
||||||
|
qt_resource_name = b"\
|
||||||
|
\x00\x0e\
|
||||||
|
\x02\x18\x8f\xc3\
|
||||||
|
\x00\x72\
|
||||||
|
\x00\x65\x00\x73\x00\x70\x00\x6f\x00\x6e\x00\x73\x00\x65\x00\x5f\x00\x63\x00\x6f\x00\x64\x00\x65\x00\x73\
|
||||||
|
\x00\x0a\
|
||||||
|
\x0a\xbc\x6f\xc7\
|
||||||
|
\x00\x53\
|
||||||
|
\x00\x65\x00\x6e\x00\x64\x00\x65\x00\x64\x00\x2e\x00\x70\x00\x6e\x00\x67\
|
||||||
|
\x00\x0b\
|
||||||
|
\x00\xfd\xde\x27\
|
||||||
|
\x00\x53\
|
||||||
|
\x00\x65\x00\x6e\x00\x64\x00\x69\x00\x6e\x00\x67\x00\x2e\x00\x70\x00\x6e\x00\x67\
|
||||||
|
\x00\x0a\
|
||||||
|
\x02\xbe\xc7\x47\
|
||||||
|
\x00\x46\
|
||||||
|
\x00\x61\x00\x69\x00\x6c\x00\x65\x00\x64\x00\x2e\x00\x70\x00\x6e\x00\x67\
|
||||||
|
"
|
||||||
|
|
||||||
|
qt_resource_struct_v1 = b"\
|
||||||
|
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
|
||||||
|
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00\x02\
|
||||||
|
\x00\x00\x00\x3c\x00\x00\x00\x00\x00\x01\x00\x00\x01\x03\
|
||||||
|
\x00\x00\x00\x58\x00\x00\x00\x00\x00\x01\x00\x00\x02\x0d\
|
||||||
|
\x00\x00\x00\x22\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
|
||||||
|
"
|
||||||
|
|
||||||
|
qt_resource_struct_v2 = b"\
|
||||||
|
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
|
||||||
|
\x00\x00\x00\x00\x00\x00\x00\x00\
|
||||||
|
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00\x02\
|
||||||
|
\x00\x00\x00\x00\x00\x00\x00\x00\
|
||||||
|
\x00\x00\x00\x3c\x00\x00\x00\x00\x00\x01\x00\x00\x01\x03\
|
||||||
|
\x00\x00\x01\x7b\xee\xa1\x60\x28\
|
||||||
|
\x00\x00\x00\x58\x00\x00\x00\x00\x00\x01\x00\x00\x02\x0d\
|
||||||
|
\x00\x00\x01\x7b\xee\xa1\x8d\x13\
|
||||||
|
\x00\x00\x00\x22\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\
|
||||||
|
\x00\x00\x01\x7b\xee\xa1\xd7\x4c\
|
||||||
|
"
|
||||||
|
|
||||||
|
qt_version = [int(v) for v in QtCore.qVersion().split('.')]
|
||||||
|
if qt_version < [5, 8, 0]:
|
||||||
|
rcc_version = 1
|
||||||
|
qt_resource_struct = qt_resource_struct_v1
|
||||||
|
else:
|
||||||
|
rcc_version = 2
|
||||||
|
qt_resource_struct = qt_resource_struct_v2
|
||||||
|
|
||||||
|
def qInitResources():
|
||||||
|
QtCore.qRegisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||||
|
|
||||||
|
def qCleanupResources():
|
||||||
|
QtCore.qUnregisterResourceData(rcc_version, qt_resource_struct, qt_resource_name, qt_resource_data)
|
||||||
|
|
||||||
|
qInitResources()
|
Loading…
Reference in New Issue
Block a user