From bf21b788f7655d6a11aa4e344d0bda21bc4c1069 Mon Sep 17 00:00:00 2001 From: Khoroshevskyi Date: Mon, 12 Feb 2024 22:11:59 +0100 Subject: [PATCH] fixed pr comments --- pephubclient/helpers.py | 7 ++----- pephubclient/modules/sample.py | 4 +++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/pephubclient/helpers.py b/pephubclient/helpers.py index a9f764b..85979bf 100644 --- a/pephubclient/helpers.py +++ b/pephubclient/helpers.py @@ -16,6 +16,7 @@ import requests from requests.exceptions import ConnectionError +from urllib.parse import urlencode from ubiquerg import parse_registry_path from pydantic import ValidationError @@ -76,11 +77,7 @@ def parse_query_param(pep_variables: dict) -> str: :param pep_variables: dict of query parameters :return: PEPHubClient variables transformed into string in correct format. """ - parsed_variables = [] - - for variable_name, variable_value in pep_variables.items(): - parsed_variables.append(f"{variable_name}={variable_value}") - return "?" + "&".join(parsed_variables) + return "?" + urlencode(pep_variables) @staticmethod def parse_header(jwt_data: Optional[str] = None) -> dict: diff --git a/pephubclient/modules/sample.py b/pephubclient/modules/sample.py index 0194af9..c8208d1 100644 --- a/pephubclient/modules/sample.py +++ b/pephubclient/modules/sample.py @@ -49,7 +49,9 @@ def get( if response.status_code == ResponseStatusCodes.OK: return self.decode_response(response, output_json=True) if response.status_code == ResponseStatusCodes.NOT_EXIST: - raise ResponseError("Sample does not exist.") + raise ResponseError( + f"Sample does not exist. Project: '{namespace}/{name}:{tag}'. Sample_name: '{sample_name}'" + ) elif response.status_code == ResponseStatusCodes.INTERNAL_ERROR: raise ResponseError("Internal server error. Unexpected return value.") else: