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

WebAPI.update()   A

Complexity

Conditions 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
c 1
b 0
f 0
dl 0
loc 9
rs 9.6666
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