@@ -282,15 +282,11 @@ def generate_signed_url_v2(
282
282
.. note::
283
283
284
284
If you are on Google Compute Engine, you can't generate a signed URL.
285
- Follow `Issue 922`_ for updates on this. If you'd like to be able to
286
- generate a signed URL from GCE, you can use a standard service account
287
- from a JSON file rather than a GCE service account.
285
+ If you'd like to be able to generate a signed URL from GCE, you can use a
286
+ standard service account from a JSON file rather than a GCE service account.
288
287
289
- See headers `reference`_ for more details on optional arguments.
290
-
291
- .. _Issue 922: https://github.com/GoogleCloudPlatform/\
292
- google-cloud-python/issues/922
293
- .. _reference: https://cloud.google.com/storage/docs/reference-headers
288
+ See headers [reference](https://cloud.google.com/storage/docs/reference-headers)
289
+ for more details on optional arguments.
294
290
295
291
:type credentials: :class:`google.auth.credentials.Signing`
296
292
:param credentials: Credentials object with an associated private key to
@@ -382,6 +378,8 @@ def generate_signed_url_v2(
382
378
elements_to_sign .append (canonical .resource )
383
379
string_to_sign = "\n " .join (elements_to_sign )
384
380
381
+ # If you are on Google Compute Engine, you can't generate a signed URL.
382
+ # See https://github.com/googleapis/google-cloud-python/issues/922
385
383
# Set the right query parameters.
386
384
if access_token and service_account_email :
387
385
signature = _sign_message (string_to_sign , access_token , service_account_email )
@@ -446,16 +444,11 @@ def generate_signed_url_v4(
446
444
.. note::
447
445
448
446
If you are on Google Compute Engine, you can't generate a signed URL.
449
- Follow `Issue 922`_ for updates on this. If you'd like to be able to
450
- generate a signed URL from GCE, you can use a standard service account
451
- from a JSON file rather than a GCE service account.
452
-
453
- See headers `reference`_ for more details on optional arguments.
454
-
455
- .. _Issue 922: https://github.com/GoogleCloudPlatform/\
456
- google-cloud-python/issues/922
457
- .. _reference: https://cloud.google.com/storage/docs/reference-headers
447
+ If you'd like to be able to generate a signed URL from GCE,you can use a
448
+ standard service account from a JSON file rather than a GCE service account.
458
449
450
+ See headers [reference](https://cloud.google.com/storage/docs/reference-headers)
451
+ for more details on optional arguments.
459
452
460
453
:type credentials: :class:`google.auth.credentials.Signing`
461
454
:param credentials: Credentials object with an associated private key to
@@ -543,6 +536,8 @@ def generate_signed_url_v4(
543
536
request_timestamp = _request_timestamp
544
537
datestamp = _request_timestamp [:8 ]
545
538
539
+ # If you are on Google Compute Engine, you can't generate a signed URL.
540
+ # See https://github.com/googleapis/google-cloud-python/issues/922
546
541
client_email = service_account_email
547
542
if not access_token or not service_account_email :
548
543
ensure_signed_credentials (credentials )
0 commit comments