diff --git a/glances/__init__.py b/glances/__init__.py index da642a3b..23bbd18c 100644 --- a/glances/__init__.py +++ b/glances/__init__.py @@ -21,6 +21,7 @@ import sys # Version should start and end with a numerical char # See https://packaging.python.org/specifications/core-metadata/#version __version__ = '4.0.0_beta01' +__apiversion__ = '4' __author__ = 'Nicolas Hennion ' __license__ = 'LGPLv3' diff --git a/glances/outputs/glances_restful_api.py b/glances/outputs/glances_restful_api.py index f4dfde6d..a0c994e6 100644 --- a/glances/outputs/glances_restful_api.py +++ b/glances/outputs/glances_restful_api.py @@ -18,10 +18,9 @@ import socket from urllib.parse import urljoin # Replace typing_extensions by typing when Python 3.8 support will be dropped -# from typing import Annotated -from typing_extensions import Annotated +from typing import Annotated -from glances import __version__ +from glances import __version__, __apiversion__ from glances.password import GlancesPassword from glances.timer import Timer from glances.logger import logger @@ -51,7 +50,7 @@ security = HTTPBasic() class GlancesRestfulApi(object): """This class manages the Restful API server.""" - API_VERSION = '4' + API_VERSION = __apiversion__ def __init__(self, config=None, args=None): # Init config diff --git a/glances/outputs/glances_stdout_apidoc.py b/glances/outputs/glances_stdout_apidoc.py index 1857be78..908b4b16 100644 --- a/glances/outputs/glances_stdout_apidoc.py +++ b/glances/outputs/glances_stdout_apidoc.py @@ -13,12 +13,12 @@ from pprint import pformat import json import time -from glances.outputs.glances_restful_api import GlancesRestfulApi +from glances import __apiversion__ from glances.logger import logger from glances.globals import iteritems -API_URL = "http://localhost:61208/api/{api_version}".format(api_version=GlancesRestfulApi.API_VERSION) +API_URL = "http://localhost:61208/api/{api_version}".format(api_version=__apiversion__) APIDOC_HEADER = """\ .. _api: @@ -65,7 +65,7 @@ It is possible to change the Web UI refresh rate (default is 2 seconds) using th ``http://localhost:61208/glances/?refresh=5`` """.format( - api_version=GlancesRestfulApi.API_VERSION + api_version=__apiversion__ ) diff --git a/glances/standalone.py b/glances/standalone.py index a1e62e59..c90b927c 100644 --- a/glances/standalone.py +++ b/glances/standalone.py @@ -12,8 +12,9 @@ import sys import time -from glances.globals import WINDOWS from glances.logger import logger + +from glances.globals import WINDOWS from glances.processes import glances_processes from glances.stats import GlancesStats from glances.outputs.glances_curses import GlancesCursesStandalone