From f6a18318d825c69bb833e37c0755dc40452c486c Mon Sep 17 00:00:00 2001 From: Josh Pooley Date: Thu, 2 Nov 2023 15:18:13 +0000 Subject: [PATCH 1/2] chore: increase sleep time to 20 --- CHANGELOG.md | 5 +++++ setup.cfg | 2 +- src/osdatahub/DownloadsAPI/downloads_api.py | 2 +- src/osdatahub/__init__.py | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e14e45d..76a2752 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## [1.2.9] - 2023/10/04 + +### Changed +- Increased DownloadsAPI sleep time to 20 + ## [1.2.8] - 2023/10/04 ### Added diff --git a/setup.cfg b/setup.cfg index 8193335..2650aca 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = osdatahub -version = 1.2.8 +version = 1.2.9 author = OS Rapid Prototyping author_email = rapidprototyping@os.uk classifiers = diff --git a/src/osdatahub/DownloadsAPI/downloads_api.py b/src/osdatahub/DownloadsAPI/downloads_api.py index 613175d..cceaf76 100644 --- a/src/osdatahub/DownloadsAPI/downloads_api.py +++ b/src/osdatahub/DownloadsAPI/downloads_api.py @@ -78,7 +78,7 @@ def download(self, output_dir: Union[str, Path], overwrite: bool = False, pbar: except HTTPError as exc: if int(exc.response.status_code) == 429: - time.sleep(1) + time.sleep(20) continue raise diff --git a/src/osdatahub/__init__.py b/src/osdatahub/__init__.py index 0062a48..ce64406 100644 --- a/src/osdatahub/__init__.py +++ b/src/osdatahub/__init__.py @@ -9,7 +9,7 @@ def set_proxies(proxies): def get_proxies(): return json.loads(os.environ["_OSDATAHUB_PROXIES"]) -__version__ = "1.2.8" +__version__ = "1.2.9" from osdatahub.extent import Extent from osdatahub.FeaturesAPI import FeaturesAPI From 42003641b41c5e6d1f5aa5c626fad18c0a0835e8 Mon Sep 17 00:00:00 2001 From: Josh Pooley Date: Thu, 2 Nov 2023 15:49:09 +0000 Subject: [PATCH 2/2] tests: temporary fix for datapackage test --- tests/test_downloads_api.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/test_downloads_api.py b/tests/test_downloads_api.py index 218a62d..3baf93e 100644 --- a/tests/test_downloads_api.py +++ b/tests/test_downloads_api.py @@ -77,15 +77,14 @@ def data_package(self): @pytest.mark.skipif(API_KEY is None, reason="Test API key not available") def test_download_pass(self): # Arrange - product_package = DataPackageDownload(API_KEY, "98") - files_to_download = product_package.product_list("156") + product_package = DataPackageDownload(API_KEY, "97") # Act with tempfile.TemporaryDirectory() as tmpdirname: - downloaded = product_package.download("156", tmpdirname) + downloaded = product_package.download("17094", tmpdirname, "bld_fts_buildingpart_orderSummary.json") # Assert - assert len(downloaded) == len(files_to_download["downloads"]) + assert len(downloaded) == 1 def test_download_list_pass(self): # TODO: implement download_list_pass