Skip to content

Commit 5a48ed5

Browse files
authored
fix(storage): update storage endpoint from www.googleapis.com to storage.googleapis.com (#9543)
1 parent cee0924 commit 5a48ed5

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

google/cloud/storage/_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
STORAGE_EMULATOR_ENV_VAR = "STORAGE_EMULATOR_HOST"
2525
"""Environment variable defining host for Storage emulator."""
2626

27-
_DEFAULT_STORAGE_HOST = u"https://www.googleapis.com"
27+
_DEFAULT_STORAGE_HOST = u"https://storage.googleapis.com"
2828

2929

3030
def _get_storage_host():

google/cloud/storage/_http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Connection(_http.JSONConnection):
2929
:param client_info: (Optional) instance used to generate user agent.
3030
"""
3131

32-
DEFAULT_API_ENDPOINT = _http.API_BASE_URL
32+
DEFAULT_API_ENDPOINT = "https://storage.googleapis.com"
3333

3434
def __init__(self, client, client_info=None, api_endpoint=DEFAULT_API_ENDPOINT):
3535
super(Connection, self).__init__(client, client_info)

tests/unit/test_blob.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ def test__get_download_url_on_the_fly(self):
725725
self.assertIsNone(blob.media_link)
726726
download_url = blob._get_download_url()
727727
expected_url = (
728-
"https://www.googleapis.com/download/storage/v1/b/"
728+
"https://storage.googleapis.com/download/storage/v1/b/"
729729
"buhkit/o/bzzz-fly.txt?alt=media"
730730
)
731731
self.assertEqual(download_url, expected_url)
@@ -741,7 +741,7 @@ def test__get_download_url_on_the_fly_with_generation(self):
741741
self.assertIsNone(blob.media_link)
742742
download_url = blob._get_download_url()
743743
expected_url = (
744-
"https://www.googleapis.com/download/storage/v1/b/"
744+
"https://storage.googleapis.com/download/storage/v1/b/"
745745
"fictional/o/pretend.txt?alt=media&generation=1493058489532987"
746746
)
747747
self.assertEqual(download_url, expected_url)
@@ -755,7 +755,7 @@ def test__get_download_url_on_the_fly_with_user_project(self):
755755
self.assertIsNone(blob.media_link)
756756
download_url = blob._get_download_url()
757757
expected_url = (
758-
"https://www.googleapis.com/download/storage/v1/b/"
758+
"https://storage.googleapis.com/download/storage/v1/b/"
759759
"fictional/o/pretend.txt?alt=media&userProject={}".format(user_project)
760760
)
761761
self.assertEqual(download_url, expected_url)
@@ -774,7 +774,7 @@ def test__get_download_url_on_the_fly_with_kms_key_name(self):
774774
self.assertIsNone(blob.media_link)
775775
download_url = blob._get_download_url()
776776
expected_url = (
777-
"https://www.googleapis.com/download/storage/v1/b/"
777+
"https://storage.googleapis.com/download/storage/v1/b/"
778778
"buhkit/o/bzzz-fly.txt?alt=media"
779779
)
780780
self.assertEqual(download_url, expected_url)
@@ -1020,7 +1020,7 @@ def test_download_to_file_wo_media_link(self):
10201020
self.assertIsNone(blob.media_link)
10211021

10221022
expected_url = (
1023-
"https://www.googleapis.com/download/storage/v1/b/"
1023+
"https://storage.googleapis.com/download/storage/v1/b/"
10241024
"name/o/blob-name?alt=media"
10251025
)
10261026
self._check_session_mocks(client, transport, expected_url)
@@ -1375,7 +1375,9 @@ def _do_multipart_success(
13751375

13761376
mock_get_boundary.assert_called_once_with()
13771377

1378-
upload_url = "https://www.googleapis.com/upload/storage/v1" + bucket.path + "/o"
1378+
upload_url = (
1379+
"https://storage.googleapis.com/upload/storage/v1" + bucket.path + "/o"
1380+
)
13791381

13801382
qs_params = [("uploadType", "multipart")]
13811383

@@ -1498,7 +1500,9 @@ def _initiate_resumable_helper(
14981500
# Check the returned values.
14991501
self.assertIsInstance(upload, ResumableUpload)
15001502

1501-
upload_url = "https://www.googleapis.com/upload/storage/v1" + bucket.path + "/o"
1503+
upload_url = (
1504+
"https://storage.googleapis.com/upload/storage/v1" + bucket.path + "/o"
1505+
)
15021506
qs_params = [("uploadType", "resumable")]
15031507

15041508
if user_project is not None:
@@ -1621,7 +1625,7 @@ def _make_resumable_transport(self, headers1, headers2, headers3, total_bytes):
16211625
def _do_resumable_upload_call0(blob, content_type, size=None, predefined_acl=None):
16221626
# First mock transport.request() does initiates upload.
16231627
upload_url = (
1624-
"https://www.googleapis.com/upload/storage/v1"
1628+
"https://storage.googleapis.com/upload/storage/v1"
16251629
+ blob.bucket.path
16261630
+ "/o?uploadType=resumable"
16271631
)
@@ -1980,7 +1984,7 @@ def _create_resumable_upload_session_helper(self, origin=None, side_effect=None)
19801984

19811985
# Check the mocks.
19821986
upload_url = (
1983-
"https://www.googleapis.com/upload/storage/v1"
1987+
"https://storage.googleapis.com/upload/storage/v1"
19841988
+ bucket.path
19851989
+ "/o?uploadType=resumable"
19861990
)

0 commit comments

Comments
 (0)