Skip to content

Commit 4cceedc

Browse files
committed
Rename GCSCollectionClient base_url param
Use `collection_address` to match `GCSClient`.
1 parent e0d5e3e commit 4cceedc

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

src/globus_sdk/experimental/gcs_collection_client.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,19 @@ class GCSCollectionClient(globus_sdk.BaseClient):
4242
A client for interacting directly with a GCS Collection.
4343
Typically for HTTPS upload/download via HTTPS-enabled collections.
4444
45-
.. note::
46-
47-
Because the client communicates directly with paths on the collection, rather
48-
than with the Endpoint hosting it, the ``base_url`` parameter is required.
49-
5045
.. sdk-sphinx-copy-params:: BaseClient
5146
5247
:param collection_id: The ID of the collection.
48+
:param collection_address: The URL of the collection, as might be retrieved from
49+
the ``https_server`` field in Globus Transfer.
5350
"""
5451

5552
scopes: GCSCollectionScopes = _GCSCollectionScopesClassStub()
5653

5754
def __init__(
5855
self,
5956
collection_id: str | uuid.UUID,
60-
base_url: str,
57+
collection_address: str,
6158
*,
6259
environment: str | None = None,
6360
app: globus_sdk.GlobusApp | None = None,
@@ -70,9 +67,12 @@ def __init__(
7067
self.collection_id = str(collection_id)
7168
self.scopes = GCSCollectionScopes(self.collection_id)
7269

70+
if not collection_address.startswith("https://"):
71+
collection_address = f"https://{collection_address}"
72+
7373
super().__init__(
7474
environment=environment,
75-
base_url=base_url,
75+
base_url=collection_address,
7676
app=app,
7777
app_scopes=app_scopes,
7878
authorizer=authorizer,

tests/unit/experimental/test_gcs_collection_client.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,11 @@ def test_default_scope_is_https():
3434
assert client.default_scope_requirements == [
3535
globus_sdk.Scope("https://auth.globus.org/scopes/foo_id/https")
3636
]
37+
38+
39+
# this behavior imitates the `GCSClient`, which accepts a bare hostname and prepends the
40+
# scheme if it is missing
41+
def test_https_scheme_is_added_to_bare_address():
42+
client = GCSCollectionClient("foo_id", "example.com")
43+
44+
assert client.base_url == "https://example.com"

0 commit comments

Comments
 (0)