Skip to content

Commit

Permalink
Register wasb[s] scheme for url manipulations #912
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirill888 committed Apr 16, 2020
1 parent 3a25b6f commit 996b395
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
16 changes: 9 additions & 7 deletions datacube/utils/uris.py
Expand Up @@ -222,10 +222,12 @@ def register_scheme(*schemes):
urllib.parse.uses_params.extend(schemes)


# s3:// not recognised by python by default
# without this `urljoin` might be broken for s3 urls
register_scheme('s3')

# gs:// not recognised by python by default
# without this `urljoin` might be broken for google storage urls
register_scheme('gs')
# `urljoin`, that we use for relative path computation, needs to know which url
# schemes support relative offsets. By default only well known types are
# understood. So here we register more common blob store url protocols.
register_scheme(
's3', # `s3://...` -- AWS S3 Object Store
'gs', # `gs://...` -- Google Cloud Storage
'wasb', # `wasb[s]://...` -- Windows Azure Storage Blob
'wasbs'
)
4 changes: 4 additions & 0 deletions tests/test_utils_other.py
Expand Up @@ -107,6 +107,8 @@ def test_uri_to_local_path():
@pytest.mark.parametrize("base", [
"s3://foo",
"gs://foo",
"wasb://foo",
"wasbs://foo",
"/vsizip//vsicurl/https://host.tld/some/path",
])
def test_uri_resolve(base):
Expand Down Expand Up @@ -511,6 +513,8 @@ def test_testutils_geobox():
("test.bar", False),
("s3://mybucket/objname.tiff", True),
("gs://mybucket/objname.tiff", True),
("wasb://mybucket/objname.tiff", True),
("wasbs://mybucket/objname.tiff", True),
("ftp://host.name/filename.txt", True),
("https://host.name.com/path/file.txt", True),
("http://host.name.com/path/file.txt", True),
Expand Down

0 comments on commit 996b395

Please sign in to comment.