Use top-level module for api version number instead of a fixed value

This commit is contained in:
allegroai 2020-03-01 17:51:03 +02:00
parent f9516ec7d3
commit 69714d5b5c

View File

@ -9,6 +9,7 @@ import jsonmodels.models
import timing_context import timing_context
from apierrors import APIError from apierrors import APIError
from apierrors.errors.bad_request import RequestPathHasInvalidVersion from apierrors.errors.bad_request import RequestPathHasInvalidVersion
from api_version import __version__ as _api_version_
from config import config from config import config
from service_repo.base import PartialVersion from service_repo.base import PartialVersion
from .apicall import APICall from .apicall import APICall
@ -34,7 +35,7 @@ class ServiceRepo(object):
"""If the check is set, parsing will fail for endpoint request with the version that is grater than the current """If the check is set, parsing will fail for endpoint request with the version that is grater than the current
maximum """ maximum """
_max_version = PartialVersion("2.6") _max_version = PartialVersion(".".join(_api_version_.split(".")[:2]))
""" Maximum version number (the highest min_version value across all endpoints) """ """ Maximum version number (the highest min_version value across all endpoints) """
_endpoint_exp = ( _endpoint_exp = (
@ -166,7 +167,7 @@ class ServiceRepo(object):
return return
assert isinstance(endpoint, Endpoint) assert isinstance(endpoint, Endpoint)
call.actual_endpoint_version: PartialVersion = endpoint.min_version call.actual_endpoint_version = endpoint.min_version
call.requires_authorization = endpoint.authorize call.requires_authorization = endpoint.authorize
return endpoint return endpoint