diff --git a/multiversx_sdk_cli/_version.py b/multiversx_sdk_cli/_version.py index 98886d26..15cf1350 100644 --- a/multiversx_sdk_cli/_version.py +++ b/multiversx_sdk_cli/_version.py @@ -1 +1 @@ -__version__ = "5.2.1" +__version__ = "5.2.2" diff --git a/multiversx_sdk_cli/contract_verification.py b/multiversx_sdk_cli/contract_verification.py index eac612ad..df121100 100644 --- a/multiversx_sdk_cli/contract_verification.py +++ b/multiversx_sdk_cli/contract_verification.py @@ -11,6 +11,9 @@ from nacl.signing import SigningKey import requests +HTTP_REQUEST_TIMEOUT = 408 +HTTP_SUCCESS = 200 + logger = logging.getLogger("cli.contracts.verifier") class ContractVerificationRequest: @@ -79,19 +82,25 @@ def trigger_contract_verification( request_dictionary = contract_verification.to_dictionary() url = f"{verifier_url}/verifier" - response = requests.post(url, json=request_dictionary).json() + response = requests.post(url, json=request_dictionary) - status = response.get("status", "") - if status: - logger.info(f"Task status: {status}") + if response.status_code == HTTP_REQUEST_TIMEOUT: + task_id = response.json().get("taskId", "") - if status == "error": - dump_out_json(response) + if task_id: + query_status_with_task_id(verifier_url, task_id) else: - dump_out_json(response) - else: - task_id = response.get("taskId", "") - query_status_with_task_id(verifier_url, task_id) + dump_out_json(response.json()) + elif response.status_code != HTTP_SUCCESS: + dump_out_json(response.json()) + elif response.status_code == HTTP_SUCCESS: + status = response.json().get("status", "") + if status: + logger.info(f"Task status: {status}") + dump_out_json(response.json()) + else: + task_id = response.json().get("taskId", "") + query_status_with_task_id(verifier_url, task_id) def query_status_with_task_id(url: str, task_id: str, interval: int = 10): diff --git a/setup.py b/setup.py index ab2d5193..949256fa 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ import setuptools -VERSION = "5.2.1" +VERSION = "5.2.2" try: with open('./multiversx_sdk_cli/_version.py', 'wt') as versionfile: