Skip to content

Commit

Permalink
feat(ingest-xmlupload): add support for dumping HTTP requests (DEV-3167
Browse files Browse the repository at this point in the history
…) (#729)
  • Loading branch information
jnussbaum committed Jan 10, 2024
1 parent 76203cf commit a02dda5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/dsp_tools/cli/call_action.py
Expand Up @@ -156,6 +156,7 @@ def _call_ingest_xmlupload(args: argparse.Namespace) -> bool:
password=args.password,
dsp_url=args.server,
sipi_url=args.sipi_url,
dump=args.dump,
)
return True

Expand Down
1 change: 1 addition & 0 deletions src/dsp_tools/cli/create_parsers.py
Expand Up @@ -194,6 +194,7 @@ def _add_ingest_xmlupload(
subparser.add_argument("-s", "--server", default=default_dsp_api_url, help=dsp_server_text)
subparser.add_argument("-u", "--user", default=root_user_email, help=username_text)
subparser.add_argument("-p", "--password", default=root_user_pw, help=password_text)
subparser.add_argument("-d", "--dump", action="store_true", help="write every request to DSP-API/SIPI into a file")
subparser.add_argument("xml_file", help="path to XML file containing the data")


Expand Down
6 changes: 4 additions & 2 deletions src/dsp_tools/commands/ingest_xmlupload/upload_xml.py
Expand Up @@ -8,7 +8,7 @@
get_mapping_dict_from_file,
replace_filepath_with_sipi_id,
)
from dsp_tools.commands.xmlupload.upload_config import UploadConfig
from dsp_tools.commands.xmlupload.upload_config import DiagnosticsConfig, UploadConfig
from dsp_tools.commands.xmlupload.xmlupload import xmlupload
from dsp_tools.models.exceptions import InputError
from dsp_tools.utils.create_logger import get_logger
Expand All @@ -23,6 +23,7 @@ def ingest_xmlupload(
password: str,
dsp_url: str,
sipi_url: str,
dump: bool = False,
) -> None:
"""
This function reads an XML file
Expand All @@ -38,6 +39,7 @@ def ingest_xmlupload(
password: the user's password for login into DSP
dsp_url: URL to the DSP server
sipi_url: URL to the Sipi server
dump: if True, write every request to DSP-API/SIPI into a file
Raises:
InputError: if any media was not uploaded or uploaded media was not referenced.
Expand Down Expand Up @@ -66,5 +68,5 @@ def ingest_xmlupload(
password=password,
imgdir=".",
sipi=sipi_url,
config=UploadConfig(media_previously_uploaded=True),
config=UploadConfig(media_previously_uploaded=True, diagnostics=DiagnosticsConfig(dump=dump)),
)

0 comments on commit a02dda5

Please sign in to comment.