Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(storage): update storage endpoint from www.googleapis.com to storage.googleapis.com #9543

Merged
merged 1 commit into from
Oct 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
crwilcox marked this conversation as resolved.
Show resolved Hide resolved

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