Skip to content

Commit

Permalink
Always set ia scanner if set_scanner is True
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jake authored and jake committed Aug 13, 2024
1 parent c1d0867 commit a47d6ea
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions internetarchive/iarequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit a47d6ea

Please sign in to comment.