Skip to content

Commit 11eabae

Browse files
ap--martindurant
andauthored
Add class attribute protocol to HTTPFileSystem (#1935)
Co-authored-by: Martin Durant <[email protected]>
1 parent 7690a43 commit 11eabae

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

fsspec/implementations/http.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class HTTPFileSystem(AsyncFileSystem):
4343
HTML href tags will be used.
4444
"""
4545

46+
protocol = ("http", "https")
4647
sep = "/"
4748

4849
def __init__(

fsspec/implementations/tests/test_http.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,3 +630,15 @@ def test_pipe_file(server, tmpdir, reset_files):
630630
bytesio = io.BytesIO(b"BytesIO content")
631631
fs.pipe_file(server.address + "/piped_bytes", bytesio.getvalue())
632632
assert fs.cat(server.address + "/piped_bytes") == b"BytesIO content"
633+
634+
635+
@pytest.mark.parametrize("protocol", ["http", "https"])
636+
def test_protocol_independent_of_first_used_protocol(protocol):
637+
from fsspec import filesystem
638+
639+
filesystem(protocol)
640+
fs0 = filesystem("http")
641+
p0 = fs0.protocol[0] if isinstance(fs0.protocol, tuple) else fs0.protocol
642+
fs1 = filesystem("https")
643+
p1 = fs1.protocol[0] if isinstance(fs1.protocol, tuple) else fs1.protocol
644+
assert p0 == p1 == "http"

0 commit comments

Comments
 (0)