Total Complexity | 4 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import json |
||
2 | import logging |
||
3 | from tabpy.tabpy_server.handlers import BaseHandler |
||
4 | |||
5 | |||
6 | class StatusHandler(BaseHandler): |
||
7 | def initialize(self, app): |
||
8 | super(StatusHandler, self).initialize(app) |
||
9 | |||
10 | def get(self): |
||
11 | if self.should_fail_with_not_authorized(): |
||
12 | self.fail_with_not_authorized() |
||
13 | return |
||
14 | |||
15 | self._add_CORS_header() |
||
16 | |||
17 | status_dict = {} |
||
18 | for k, v in self.python_service.ps.query_objects.items(): |
||
19 | status_dict[k] = { |
||
20 | 'version': v['version'], |
||
21 | 'type': v['type'], |
||
22 | 'status': v['status'], |
||
23 | 'last_error': v['last_error']} |
||
24 | |||
25 | self.logger.log( |
||
26 | logging.DEBUG, |
||
27 | f'Found models: {status_dict}') |
||
28 | self.write(json.dumps(status_dict)) |
||
29 | self.finish() |
||
30 | return |
||
31 |