Skip to content

Commit

Permalink
Merge pull request #102 from OrdnanceSurvey/fix/sleep
Browse files Browse the repository at this point in the history
Increase sleep time to 20
  • Loading branch information
JEPooley authored Nov 2, 2023
2 parents 27abb8e + a2af8ce commit 86dc247
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = osdatahub
version = 1.2.8
version = 1.2.9
author = OS Rapid Prototyping
author_email = [email protected]
classifiers =
Expand Down
2 changes: 1 addition & 1 deletion src/osdatahub/DownloadsAPI/downloads_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/osdatahub/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions tests/test_downloads_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 86dc247

Please sign in to comment.