Passed
Pull Request — master (#157)
by macartur
01:33
created

WebAPI   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 12
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A update() 0 9 2
1
"""Translate cli commands to non-cli code."""
2
import logging
3
from urllib.error import HTTPError, URLError
4
5
import requests
6
7
LOG = logging.getLogger(__name__)
8
9
10
class WebAPI:  # pylint: disable=too-few-public-methods
11
    """An API for the command-line interface."""
12
13
    @classmethod
14
    def update(cls):
15
        """Call the method to update the Web UI."""
16
        url = "http://localhost:8181/api/kytos/core/update_ui"
17
        try:
18
            requests.get(url)
19
        except(HTTPError, URLError):
20
            LOG.error("Error while updating the web ui")
21
        LOG.info("Web UI updated.")
22