Replaces hardcoded 16/32 for LOCATOR lengths

This commit is contained in:
Sergi Delgado Segura
2019-12-05 11:26:58 +01:00
parent bd08b151df
commit b4197aa5bb
6 changed files with 53 additions and 21 deletions

View File

@@ -8,7 +8,8 @@ from pisa.logger import Logger
from pisa.inspector import Inspector
from pisa.appointment import Appointment
from pisa.block_processor import BlockProcessor
from common.constants import HTTP_OK, HTTP_BAD_REQUEST, HTTP_SERVICE_UNAVAILABLE
from common.constants import HTTP_OK, HTTP_BAD_REQUEST, HTTP_SERVICE_UNAVAILABLE, LOCATOR_LEN_HEX
# ToDo: #5-add-async-to-api
@@ -74,7 +75,7 @@ def get_appointment():
response = []
# ToDo: #15-add-system-monitor
if not isinstance(locator, str) or len(locator) != 32:
if not isinstance(locator, str) or len(locator) != LOCATOR_LEN_HEX:
response.append({"locator": locator, "status": "not_found"})
return jsonify(response)