From a47d6ea5031cff1a24aba522140f905e962aaca3 Mon Sep 17 00:00:00 2001 From: jake Date: Tue, 13 Aug 2024 10:30:58 -0700 Subject: [PATCH] Always set ia scanner if set_scanner is True Archive.org now supports setting multiple values for the `scanner` field. If set_scanner is True and a custom scanner is provided in user metadata, append the ia scanner as a second scanner field. --- internetarchive/iarequest.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internetarchive/iarequest.py b/internetarchive/iarequest.py index 475785c9..a748b71b 100644 --- a/internetarchive/iarequest.py +++ b/internetarchive/iarequest.py @@ -119,9 +119,12 @@ def prepare_headers(self, headers, metadata, file_metadata=None, queue_derive=Tr metadata = {} if metadata is None else metadata file_metadata = {} if file_metadata is None else file_metadata - if not metadata.get('scanner') and set_scanner is True: + if set_scanner is True: scanner = f'Internet Archive Python library {__version__}' - metadata['scanner'] = scanner + if metadata.get('scanner'): + metadata['scanner'] = [metadata['scanner'], scanner] + else: + metadata['scanner'] = scanner prepared_metadata = prepare_metadata(metadata) prepared_file_metadata = prepare_metadata(file_metadata)