Skip to content

Commit

Permalink
fixed pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
khoroshevskyi committed Feb 12, 2024
1 parent dc03117 commit bf21b78
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 2 additions & 5 deletions pephubclient/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion pephubclient/modules/sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit bf21b78

Please sign in to comment.