From 2bedbfd38e6b4c8553f7ea950f309e450f8bd722 Mon Sep 17 00:00:00 2001 From: Jan Range Date: Thu, 1 Feb 2024 15:20:03 +0100 Subject: [PATCH] cast url to string --- easyDataverse/dataverse.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/easyDataverse/dataverse.py b/easyDataverse/dataverse.py index 41dd663..e0283e7 100644 --- a/easyDataverse/dataverse.py +++ b/easyDataverse/dataverse.py @@ -100,7 +100,11 @@ def _connect(self) -> None: "The Dataverse installation is not compatible with easyDataverse. Please use a Dataverse installation >= 5.13.x" ) - dataset = Dataset(API_TOKEN=str(self.api_token), DATAVERSE_URL=self.server_url) + dataset = Dataset( + API_TOKEN=str(self.api_token), + DATAVERSE_URL=str(self.server_url), + ) + block_names = gather_metadatablock_names(str(self.server_url)) all_blocks = asyncio.run( fetch_metadatablocks( @@ -278,7 +282,10 @@ def _fetch_dataset( version = "latest" endpoint = f"/api/datasets/:persistentId/?persistentId={pid}" - url = parse.urljoin(self.server_url, endpoint) # type: ignore + url = parse.urljoin( + str(self.server_url), + endpoint, + ) # type: ignore header = {} if self.api_token is not None: @@ -299,9 +306,14 @@ def _fetch_files( """Fetches all files of a dataset.""" if self.api_token: - data_api = DataAccessApi(self.server_url, str(self.api_token)) + data_api = DataAccessApi( + str(self.server_url), + str(self.api_token), + ) else: - data_api = DataAccessApi(self.server_url) + data_api = DataAccessApi( + str(self.server_url), + ) download_files( data_api,