Package editing
This commit is contained in:
@@ -3,8 +3,8 @@ from modules.auth import get_auth
|
||||
from horsygui import login_ui, UiLoginWindow as Ui_LoginWindow
|
||||
import modules.gui as gui
|
||||
import requests
|
||||
from PyQt5 import QtWidgets
|
||||
import modules.vars as horsy_vars
|
||||
import modules.http_status as status
|
||||
import json
|
||||
|
||||
|
||||
@@ -64,6 +64,20 @@ def edit(package, UiPackageWindow):
|
||||
'run': (lambda x: x if x != '' else None)(package_ui.main_exe_box.text())
|
||||
}
|
||||
|
||||
r = requests.put(f"{horsy_vars.protocol}{horsy_vars.server_url}/packages", json=body).text # TODO: add error handling
|
||||
r = requests.put(f"{horsy_vars.protocol}{horsy_vars.server_url}/packages", json=body)
|
||||
if r.status_code == status.OK:
|
||||
gui.cpopup('Success', 'Success, package edited')
|
||||
elif r.status_code == status.UNAUTHORIZED:
|
||||
gui.cpopup('Error', 'Unauthorized')
|
||||
elif r.status_code == status.NOT_FOUND:
|
||||
gui.cpopup('Error', 'Package not found or its not yours')
|
||||
elif r.status_code == status.BAD_REQUEST:
|
||||
gui.cpopup('Error', 'Bad request')
|
||||
elif r.status_code == status.INTERNAL_SERVER_ERROR:
|
||||
gui.cpopup('Error', 'Internal server error')
|
||||
elif r.status_code == status.TOO_MANY_REQUESTS:
|
||||
gui.cpopup('Error', 'Too many requests')
|
||||
else:
|
||||
gui.cpopup('Error', 'Unknown error')
|
||||
|
||||
package_ui.update_button.clicked.connect(send)
|
||||
|
||||
Reference in New Issue
Block a user