diff --git a/client-py3/full/src/uds/rest.py b/client-py3/full/src/uds/rest.py index 3c0901b7..82c44acc 100644 --- a/client-py3/full/src/uds/rest.py +++ b/client-py3/full/src/uds/rest.py @@ -40,7 +40,12 @@ import certifi from PyQt5.QtCore import pyqtSignal from PyQt5.QtCore import QObject, QUrl, QSettings from PyQt5.QtCore import Qt -from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkReply, QSslCertificate +from PyQt5.QtNetwork import ( + QNetworkAccessManager, + QNetworkRequest, + QNetworkReply, + QSslCertificate, +) from PyQt5.QtWidgets import QMessageBox from . import os_detector @@ -48,7 +53,6 @@ from . import os_detector from . import VERSION - class RestRequest(QObject): restApiUrl = '' # @@ -60,9 +64,11 @@ class RestRequest(QObject): # private self._manager = QNetworkAccessManager() - if params is not None: - url += '?' + '&'.join('{}={}'.format(k, urllib.parse.quote(str(v).encode('utf8'))) for k, v in params.items()) + url += '?' + '&'.join( + '{}={}'.format(k, urllib.parse.quote(str(v).encode('utf8'))) + for k, v in params.items() + ) self.url = QUrl(RestRequest.restApiUrl + url) @@ -74,19 +80,16 @@ class RestRequest(QObject): self.done.connect(done, Qt.QueuedConnection) def _finished(self, reply): - ''' + """ Handle signal 'finished'. A network request has finished. - ''' + """ try: if reply.error() != QNetworkReply.NoError: raise Exception(reply.errorString()) data = bytes(reply.readAll()) data = json.loads(data) except Exception as e: - data = { - 'result': None, - 'error': str(e) - } + data = {'result': None, 'error': str(e)} self.done.emit(data) @@ -100,14 +103,27 @@ class RestRequest(QObject): approved = settings.value(digest, False) - errorString = '

The certificate for {} has the following errors: