Skip to content

Commit 05af365

Browse files
committed
Add proxy support to Dataverse API calls
Introduces a 'proxy' parameter to native_upload, _update_metadata, and _retrieve_file_ids functions, allowing API requests to be routed through a specified proxy. This enhances flexibility for deployments requiring network routing via proxies.
1 parent 1f1f758 commit 05af365

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

dvuploader/nativeupload.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ async def native_upload(
173173
persistent_id=persistent_id,
174174
dataverse_url=dataverse_url,
175175
api_token=api_token,
176+
proxy=proxy,
176177
)
177178

178179

@@ -382,6 +383,7 @@ async def _update_metadata(
382383
dataverse_url: str,
383384
api_token: str,
384385
persistent_id: str,
386+
proxy: Optional[str],
385387
):
386388
"""
387389
Updates the metadata of the given files in a Dataverse repository.
@@ -401,6 +403,7 @@ async def _update_metadata(
401403
persistent_id=persistent_id,
402404
dataverse_url=dataverse_url,
403405
api_token=api_token,
406+
proxy=proxy,
404407
)
405408

406409
tasks = []
@@ -493,6 +496,7 @@ def _retrieve_file_ids(
493496
persistent_id: str,
494497
dataverse_url: str,
495498
api_token: str,
499+
proxy: Optional[str] = None,
496500
) -> Dict[str, str]:
497501
"""
498502
Retrieves the file IDs of files in a dataset.
@@ -501,7 +505,7 @@ def _retrieve_file_ids(
501505
persistent_id (str): The persistent identifier of the dataset.
502506
dataverse_url (str): The URL of the Dataverse repository.
503507
api_token (str): The API token of the Dataverse repository.
504-
508+
proxy (str): The proxy to use for the request.
505509
Returns:
506510
Dict[str, str]: Dictionary mapping file paths to their IDs.
507511
"""
@@ -511,6 +515,7 @@ def _retrieve_file_ids(
511515
persistent_id=persistent_id,
512516
dataverse_url=dataverse_url,
513517
api_token=api_token,
518+
proxy=proxy,
514519
)
515520

516521
return _create_file_id_path_mapping(ds_files)

0 commit comments

Comments
 (0)