gcf-merge-on-green[bot]: Your PR has attempted to merge for 3 hours. Please check that all required checks have passed, you have an automerge label, and that all your reviewers have approved the PR
gcf-merge-on-green[bot]: Your PR has attempted to merge for 3 hours. Please check that all required checks have passed, you have an automerge label, and that all your reviewers have approved the PR
diff --git a/google/cloud/storage/_signing.py b/google/cloud/storage/_signing.py
index 38610b6..ae22484 100644
--- a/google/cloud/storage/_signing.py
+++ b/google/cloud/storage/_signing.py
@@ -82,7 +82,7 @@ def get_signed_query_params_v2(credentials, expiration, string_to_sign):
     service_account_name = credentials.signer_email
     return {
         "GoogleAccessId": service_account_name,
-        "Expires": str(expiration),
+        "Expires": expiration,
         "Signature": signature,
     }
 
@@ -384,7 +384,7 @@ def generate_signed_url_v2(
         signature = _sign_message(string_to_sign, access_token, service_account_email)
         signed_query_params = {
             "GoogleAccessId": service_account_email,
-            "Expires": str(expiration),
+            "Expires": expiration_stamp,
             "Signature": signature,
         }
     else:

use converted expiration parameter for signed_query_params to generate_signed_url_v2
Issue created from the comment https://github.com/googleapis/google-cloud-python/pull/9889#issuecomment-612694371

suspected line of code.
            https://github.com/googleapis/python-storage/blob/5c04eefe2599f13cf37b91cf60bd242e64b97bd7/google/cloud/storage/_signing.py#L387

/cc @frankyn 
diff --git a/tests/unit/test__signing.py b/tests/unit/test__signing.py
index 7b58a27..2907429 100644
--- a/tests/unit/test__signing.py
+++ b/tests/unit/test__signing.py
@@ -252,7 +252,7 @@ class Test_get_signed_query_params_v2(unittest.TestCase):
 
         expected = {
             "GoogleAccessId": account_name,
-            "Expires": str(expiration),
+            "Expires": expiration,
             "Signature": base64.b64encode(sig_bytes),
         }
         self.assertEqual(result, expected)

pip install -e .[dev]
parse_log_pytest
pytest
pytest pytest-cov mock
apt-get update apt-get install -y gcc
3.9
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
cachetools==4.2.4
certifi==2025.1.31
charset-normalizer==3.4.1
coverage==7.8.0
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
google-api-core==2.10.2
google-auth==1.35.0
google-cloud-core==1.7.3
-e git+https://github.com/googleapis/python-storage.git@f4de88d7253feacaab8a9fcdf180c494dafa22b8#egg=google_cloud_storage
google-resumable-media==0.5.1
googleapis-common-protos==1.69.2
idna==3.10
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
mock==5.2.0
packaging @ file:///croot/packaging_1734472117206/work
pluggy @ file:///croot/pluggy_1733169602837/work
protobuf==4.25.6
pyasn1==0.6.1
pyasn1_modules==0.4.2
pytest @ file:///croot/pytest_1738938843180/work
pytest-cov==6.0.0
requests==2.32.3
rsa==4.9
six==1.17.0
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
urllib3==2.3.0

name: python-storage
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - exceptiongroup=1.2.0=py39h06a4308_0
  - iniconfig=1.1.1=pyhd3eb1b0_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - packaging=24.2=py39h06a4308_0
  - pip=25.0=py39h06a4308_0
  - pluggy=1.5.0=py39h06a4308_0
  - pytest=8.3.4=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tomli=2.0.1=py39h06a4308_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - cachetools==4.2.4
      - certifi==2025.1.31
      - charset-normalizer==3.4.1
      - coverage==7.8.0
      - google-api-core==2.10.2
      - google-auth==1.35.0
      - google-cloud-core==1.7.3
      - google-resumable-media==0.5.1
      - googleapis-common-protos==1.69.2
      - idna==3.10
      - mock==5.2.0
      - protobuf==4.25.6
      - pyasn1==0.6.1
      - pyasn1-modules==0.4.2
      - pytest-cov==6.0.0
      - requests==2.32.3
      - rsa==4.9
      - six==1.17.0
      - urllib3==2.3.0
prefix: /opt/conda/envs/python-storage

tests/unit/test__signing.py::Test_get_signed_query_params_v2::test_it
tests/unit/test__signing.py::Test_get_expiration_seconds_v2::test_w_expiration_int tests/unit/test__signing.py::Test_get_expiration_seconds_v2::test_w_expiration_naive_datetime tests/unit/test__signing.py::Test_get_expiration_seconds_v2::test_w_expiration_none tests/unit/test__signing.py::Test_get_expiration_seconds_v2::test_w_expiration_other_zone_datetime tests/unit/test__signing.py::Test_get_expiration_seconds_v2::test_w_expiration_timedelta_days tests/unit/test__signing.py::Test_get_expiration_seconds_v2::test_w_expiration_timedelta_seconds tests/unit/test__signing.py::Test_get_expiration_seconds_v2::test_w_expiration_utc_datetime tests/unit/test__signing.py::Test_get_expiration_seconds_v2::test_w_invalid_expiration_type tests/unit/test__signing.py::Test_get_expiration_seconds_v4::test_w_expiration_int tests/unit/test__signing.py::Test_get_expiration_seconds_v4::test_w_expiration_int_gt_seven_days tests/unit/test__signing.py::Test_get_expiration_seconds_v4::test_w_expiration_naive_datetime tests/unit/test__signing.py::Test_get_expiration_seconds_v4::test_w_expiration_none tests/unit/test__signing.py::Test_get_expiration_seconds_v4::test_w_expiration_other_zone_datetime tests/unit/test__signing.py::Test_get_expiration_seconds_v4::test_w_expiration_timedelta tests/unit/test__signing.py::Test_get_expiration_seconds_v4::test_w_expiration_utc_datetime tests/unit/test__signing.py::Test_get_expiration_seconds_v4::test_w_invalid_expiration_type tests/unit/test__signing.py::Test_get_canonical_headers::test_w_dict tests/unit/test__signing.py::Test_get_canonical_headers::test_w_embedded_ws tests/unit/test__signing.py::Test_get_canonical_headers::test_w_list_and_multiples tests/unit/test__signing.py::Test_get_canonical_headers::test_w_none tests/unit/test__signing.py::Test_canonicalize_v2::test_w_headers_and_resumable tests/unit/test__signing.py::Test_canonicalize_v2::test_w_query_parameters tests/unit/test__signing.py::Test_canonicalize_v2::test_wo_headers_or_query_parameters tests/unit/test__signing.py::Test_generate_signed_url_v2::test_w_custom_headers_dict tests/unit/test__signing.py::Test_generate_signed_url_v2::test_w_custom_headers_list tests/unit/test__signing.py::Test_generate_signed_url_v2::test_w_custom_query_parameters_w_none_value tests/unit/test__signing.py::Test_generate_signed_url_v2::test_w_custom_query_parameters_w_string_value tests/unit/test__signing.py::Test_generate_signed_url_v2::test_w_endpoint tests/unit/test__signing.py::Test_generate_signed_url_v2::test_w_expiration_int tests/unit/test__signing.py::Test_generate_signed_url_v2::test_w_generation tests/unit/test__signing.py::Test_generate_signed_url_v2::test_w_method tests/unit/test__signing.py::Test_generate_signed_url_v2::test_w_method_resumable tests/unit/test__signing.py::Test_generate_signed_url_v2::test_w_response_disposition tests/unit/test__signing.py::Test_generate_signed_url_v2::test_w_response_type tests/unit/test__signing.py::Test_generate_signed_url_v2::test_with_access_token tests/unit/test__signing.py::Test_generate_signed_url_v2::test_with_google_credentials tests/unit/test__signing.py::Test_generate_signed_url_v4::test_w_api_access_endpoint tests/unit/test__signing.py::Test_generate_signed_url_v4::test_w_content_md5 tests/unit/test__signing.py::Test_generate_signed_url_v4::test_w_content_type tests/unit/test__signing.py::Test_generate_signed_url_v4::test_w_custom_headers tests/unit/test__signing.py::Test_generate_signed_url_v4::test_w_custom_host_header tests/unit/test__signing.py::Test_generate_signed_url_v4::test_w_custom_payload_hash_goog tests/unit/test__signing.py::Test_generate_signed_url_v4::test_w_custom_query_parameters_w_none_value tests/unit/test__signing.py::Test_generate_signed_url_v4::test_w_custom_query_parameters_w_string_value tests/unit/test__signing.py::Test_generate_signed_url_v4::test_w_defaults tests/unit/test__signing.py::Test_generate_signed_url_v4::test_w_expiration_too_long tests/unit/test__signing.py::Test_generate_signed_url_v4::test_w_generation tests/unit/test__signing.py::Test_generate_signed_url_v4::test_w_method tests/unit/test__signing.py::Test_generate_signed_url_v4::test_w_method_resumable tests/unit/test__signing.py::Test_generate_signed_url_v4::test_w_response_disposition tests/unit/test__signing.py::Test_generate_signed_url_v4::test_w_response_type tests/unit/test__signing.py::Test_generate_signed_url_v4::test_with_access_token tests/unit/test__signing.py::Test_sign_message::test_sign_bytes tests/unit/test__signing.py::Test_sign_message::test_sign_bytes_failure tests/unit/test__signing.py::TestCustomURLEncoding::test_url_encode tests/unit/test__signing.py::TestQuoteParam::test_ascii_symbols tests/unit/test__signing.py::TestQuoteParam::test_bytes tests/unit/test__signing.py::TestQuoteParam::test_quoted_symbols tests/unit/test__signing.py::TestQuoteParam::test_unicode_symbols tests/unit/test__signing.py::TestQuoteParam::test_unquoted_symbols tests/unit/test__signing.py::TestV4Stamps::test_get_v4_now_dtstamps tests/unit/test__signing.py::test_conformance_bucket[test_data0] tests/unit/test__signing.py::test_conformance_bucket[test_data1] tests/unit/test__signing.py::test_conformance_bucket[test_data2] tests/unit/test__signing.py::test_conformance_blob[test_data0] tests/unit/test__signing.py::test_conformance_blob[test_data1] tests/unit/test__signing.py::test_conformance_blob[test_data2] tests/unit/test__signing.py::test_conformance_blob[test_data3] tests/unit/test__signing.py::test_conformance_blob[test_data4] tests/unit/test__signing.py::test_conformance_blob[test_data5] tests/unit/test__signing.py::test_conformance_blob[test_data6] tests/unit/test__signing.py::test_conformance_blob[test_data7] tests/unit/test__signing.py::test_conformance_blob[test_data8] tests/unit/test__signing.py::test_conformance_blob[test_data9] tests/unit/test__signing.py::test_conformance_blob[test_data10] tests/unit/test__signing.py::test_conformance_blob[test_data11]
google/cloud/storage/_signing.py
google/cloud/storage/_signing.py