From 696aa02dfa80589ca48f95ac956d817dc823e3d5 Mon Sep 17 00:00:00 2001 From: rewby Date: Sat, 26 Aug 2023 23:14:34 +0200 Subject: [PATCH] Change item format. --- main.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/main.py b/main.py index 9db951b..0f57599 100755 --- a/main.py +++ b/main.py @@ -180,14 +180,10 @@ def single_impl(item_directory: pathlib.Path, ia_collection: str, ia_item_title: except Exception: logging.exception("Failed to upload") time.sleep(30) - new_url = copy.deepcopy(parsed_url) - new_url = new_url._replace(path=new_url.path.join(bucket_name)) - new_url = urllib.parse.urlunparse(new_url) - logging.info(f"Constructed backfeed url: {new_url}") - nu_part = { "url": new_url } - new_url = json.dumps(nu_part) - new_url = base64.urlsafe_b64encode(str(new_url).encode("UTF-8")).decode("UTF-8") - bf_item = f"{project}:{parsed_url.hostname}:{new_url}" + + item_data = { "url": url, "item_name": item_directory.name, "bucket_name": bucket_name } + bf_item_part = base64.urlsafe_b64encode(str(json.dumps(item_data)).encode("UTF-8")).decode("UTF-8") + bf_item = f"{project}:{parsed_url.hostname}:{bf_item_part}" else: raise Exception("Unable to upload, don't understand url: {url}")