Skip to content

Commit

Permalink
fix(storage): update storage endpoint from www.googleapis.com to stor…
Browse files Browse the repository at this point in the history
…age.googleapis.com (#9543)
  • Loading branch information
crwilcox authored Oct 25, 2019
1 parent 14e140c commit 764251d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion storage/google/cloud/storage/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
STORAGE_EMULATOR_ENV_VAR = "STORAGE_EMULATOR_HOST"
"""Environment variable defining host for Storage emulator."""

_DEFAULT_STORAGE_HOST = u"https://www.googleapis.com"
_DEFAULT_STORAGE_HOST = u"https://storage.googleapis.com"


def _get_storage_host():
Expand Down
2 changes: 1 addition & 1 deletion storage/google/cloud/storage/_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Connection(_http.JSONConnection):
:param client_info: (Optional) instance used to generate user agent.
"""

DEFAULT_API_ENDPOINT = _http.API_BASE_URL
DEFAULT_API_ENDPOINT = "https://storage.googleapis.com"

def __init__(self, client, client_info=None, api_endpoint=DEFAULT_API_ENDPOINT):
super(Connection, self).__init__(client, client_info)
Expand Down
22 changes: 13 additions & 9 deletions storage/tests/unit/test_blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ def test__get_download_url_on_the_fly(self):
self.assertIsNone(blob.media_link)
download_url = blob._get_download_url()
expected_url = (
"https://www.googleapis.com/download/storage/v1/b/"
"https://storage.googleapis.com/download/storage/v1/b/"
"buhkit/o/bzzz-fly.txt?alt=media"
)
self.assertEqual(download_url, expected_url)
Expand All @@ -741,7 +741,7 @@ def test__get_download_url_on_the_fly_with_generation(self):
self.assertIsNone(blob.media_link)
download_url = blob._get_download_url()
expected_url = (
"https://www.googleapis.com/download/storage/v1/b/"
"https://storage.googleapis.com/download/storage/v1/b/"
"fictional/o/pretend.txt?alt=media&generation=1493058489532987"
)
self.assertEqual(download_url, expected_url)
Expand All @@ -755,7 +755,7 @@ def test__get_download_url_on_the_fly_with_user_project(self):
self.assertIsNone(blob.media_link)
download_url = blob._get_download_url()
expected_url = (
"https://www.googleapis.com/download/storage/v1/b/"
"https://storage.googleapis.com/download/storage/v1/b/"
"fictional/o/pretend.txt?alt=media&userProject={}".format(user_project)
)
self.assertEqual(download_url, expected_url)
Expand All @@ -774,7 +774,7 @@ def test__get_download_url_on_the_fly_with_kms_key_name(self):
self.assertIsNone(blob.media_link)
download_url = blob._get_download_url()
expected_url = (
"https://www.googleapis.com/download/storage/v1/b/"
"https://storage.googleapis.com/download/storage/v1/b/"
"buhkit/o/bzzz-fly.txt?alt=media"
)
self.assertEqual(download_url, expected_url)
Expand Down Expand Up @@ -1020,7 +1020,7 @@ def test_download_to_file_wo_media_link(self):
self.assertIsNone(blob.media_link)

expected_url = (
"https://www.googleapis.com/download/storage/v1/b/"
"https://storage.googleapis.com/download/storage/v1/b/"
"name/o/blob-name?alt=media"
)
self._check_session_mocks(client, transport, expected_url)
Expand Down Expand Up @@ -1375,7 +1375,9 @@ def _do_multipart_success(

mock_get_boundary.assert_called_once_with()

upload_url = "https://www.googleapis.com/upload/storage/v1" + bucket.path + "/o"
upload_url = (
"https://storage.googleapis.com/upload/storage/v1" + bucket.path + "/o"
)

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

Expand Down Expand Up @@ -1498,7 +1500,9 @@ def _initiate_resumable_helper(
# Check the returned values.
self.assertIsInstance(upload, ResumableUpload)

upload_url = "https://www.googleapis.com/upload/storage/v1" + bucket.path + "/o"
upload_url = (
"https://storage.googleapis.com/upload/storage/v1" + bucket.path + "/o"
)
qs_params = [("uploadType", "resumable")]

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

# Check the mocks.
upload_url = (
"https://www.googleapis.com/upload/storage/v1"
"https://storage.googleapis.com/upload/storage/v1"
+ bucket.path
+ "/o?uploadType=resumable"
)
Expand Down

0 comments on commit 764251d

Please sign in to comment.