Skip to content

Commit

Permalink
Change _hash_values to return a string instead of bytes.
Browse files Browse the repository at this point in the history
This fixes an error when trying to store the hash in the database and aligns
with what the hasher endpoints return.
  • Loading branch information
jstutters committed Jan 31, 2024
1 parent 642eecd commit 255c23d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pixl_dcmd/src/pixl_dcmd/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,12 @@ def hash_endpoint_path_for_tag(group: bytes, element: bytes) -> str:
return "/hash"


def _hash_values(grp: bytes, el: bytes, pat_value: str, hasher_host_url: str) -> bytes:
def _hash_values(grp: bytes, el: bytes, pat_value: str, hasher_host_url: str) -> str:
ep_path = hash_endpoint_path_for_tag(group=grp, element=el)
payload = ep_path + "?message=" + pat_value
request_url = hasher_host_url + payload
response = requests.get(request_url)
logging.info(b"RESPONSE = %a}" % response.content)
return response.content
# All three hashing endpoints return application/text so should be fine to
# use response.text here
logging.info(b"RESPONSE = %a}" % response.text)
return response.text

0 comments on commit 255c23d

Please sign in to comment.