tabpy.tabpy_server.handlers.status_handler   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 36.84%

Importance

Changes 0
Metric Value
wmc 4
eloc 25
dl 0
loc 30
ccs 7
cts 19
cp 0.3684
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A StatusHandler.get() 0 20 3
A StatusHandler.initialize() 0 2 1
1 1
import json
2 1
import logging
3 1
from tabpy.tabpy_server.handlers import BaseHandler
4 1
from tabpy.tabpy_server.handlers.util import AuthErrorStates
5
6 1
class StatusHandler(BaseHandler):
7 1
    def initialize(self, app):
8
        super(StatusHandler, self).initialize(app)
9
10 1
    def get(self):
11
        if self.should_fail_with_auth_error() != AuthErrorStates.NONE:
12
            self.fail_with_auth_error()
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
26
        self.logger.log(logging.DEBUG, f"Found models: {status_dict}")
27
        self.write(json.dumps(status_dict))
28
        self.finish()
29
        return
30