|
27 | 27 |
|
28 | 28 | class ApiRequester(QObject): |
29 | 29 | """Basic class to manage direct interactions with Isogeo's API : |
30 | | - - Authentication request for tokenl |
31 | | - - Request about application's shares |
32 | | - - Request about ressources |
33 | | - - Building request URLs |
34 | | - - Parsing API's answer tags |
| 30 | + - Authentication request for tokenl |
| 31 | + - Request about application's shares |
| 32 | + - Request about ressources |
| 33 | + - Building request URLs |
| 34 | + - Parsing API's answer tags |
35 | 35 | """ |
36 | 36 |
|
37 | 37 | api_sig = pyqtSignal(str) |
@@ -130,7 +130,7 @@ def create_request(self, request_type: str): |
130 | 130 | return request |
131 | 131 |
|
132 | 132 | def send_request(self, request_type: str = "search"): |
133 | | - """ Sends a request to the Isogeo's API using QNetworkRequestManager. That's the |
| 133 | + """Sends a request to the Isogeo's API using QNetworkRequestManager. That's the |
134 | 134 | handle_reply method which get the API's response. See below. |
135 | 135 |
|
136 | 136 | :param str request_type: type of request to send. Options: |
@@ -210,6 +210,7 @@ def handle_reply(self, reply: QNetworkReply): |
210 | 210 | try: |
211 | 211 | parsed_content = json.loads(content) |
212 | 212 | except ValueError as e: |
| 213 | + parsed_content = content |
213 | 214 | if "No JSON object could be decoded" in str(e): |
214 | 215 | logger.error("{} --> Internet connection failed".format(str(e))) |
215 | 216 | self.api_sig.emit("internet_issue") |
@@ -404,7 +405,7 @@ def build_request_url(self, params: dict): |
404 | 405 | return url |
405 | 406 |
|
406 | 407 | def get_tags(self, tags: dict): |
407 | | - """ This parse the tags contained in API_answer[tags] and class them so |
| 408 | + """This parse the tags contained in API_answer[tags] and class them so |
408 | 409 | they are more easy to handle in other function such as update_fields() |
409 | 410 |
|
410 | 411 | :param dict tags: a dict of tags as thez are return by the API |
|
0 commit comments