Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
* 31.2.0
- Google Ads API v25_0 release.
- Remove `LocalServicesLead.contact_details.email` from the masking logic in
the logging interceptor, as it was removed from the API.

* 31.1.0
- Google Ads API v24_2 release.
- Update experiments examples to support new functionality.
Expand Down
2 changes: 1 addition & 1 deletion google/ads/googleads/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import google.ads.googleads.errors
import google.ads.googleads.util

VERSION = "31.1.0"
VERSION = "31.2.0"

# Checks if the current runtime is Python 3.10.
if sys.version_info.major == 3 and sys.version_info.minor <= 10:
Expand Down
2 changes: 1 addition & 1 deletion google/ads/googleads/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
_SERVICE_CLIENT_TEMPLATE = "{}Client"
_ASYNC_SERVICE_CLIENT_TEMPLATE = "{}AsyncClient"

_VALID_API_VERSIONS = ["v24", "v23", "v22", "v21"]
_VALID_API_VERSIONS = ["v25", "v24", "v23", "v22", "v21"]
_MESSAGE_TYPES = ["common", "enums", "errors", "resources", "services"]
_DEFAULT_VERSION = _VALID_API_VERSIONS[0]

Expand Down
5 changes: 3 additions & 2 deletions google/ads/googleads/interceptors/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
"Feed": ["places_location_feed_data.email_address"],
"LocalServicesLead": [
"contact_details.phone_number",
"contact_details.email",
"contact_details.phone_number_extension",
"contact_details.email", # TODO: remove this after v24 is sunset.
"contact_details.consumer_name",
],
"LocalServicesLeadConversation": ["message_details.text"],
Expand Down Expand Up @@ -114,7 +115,7 @@ def _mask_message_fields(
# AttributeError is raised when the field is not defined on the
# message. In this case there's nothing to mask and the field
# should be skipped.
break
pass

return copy

Expand Down
140 changes: 140 additions & 0 deletions google/ads/googleads/v25/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# -*- coding: utf-8 -*-
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
from google.ads.googleads.v25 import gapic_version as package_version

import google.api_core as api_core
import sys

__version__ = package_version.__version__

from importlib import metadata

# PEP 0810: Explicit Lazy Imports
# Python 3.15+ natively intercepts and defers these imports.
# Developers can disable this behavior and force eager imports.
# For more information, see:
# https://docs.python.org/3.15/library/sys.html#sys.set_lazy_imports_filter
# Older Python versions safely ignore this variable.
__lazy_modules__ = {
"google.ads.googleads.v25.actions",
"google.ads.googleads.v25.common",
"google.ads.googleads.v25.enums",
"google.ads.googleads.v25.errors",
"google.ads.googleads.v25.resources",
"google.ads.googleads.v25.services",
}

from . import actions
from . import common
from . import enums
from . import errors
from . import resources
from . import services


if hasattr(api_core, "check_python_version") and hasattr(
api_core, "check_dependency_versions"
): # pragma: NO COVER
api_core.check_python_version("google.ads.googleads.v25") # type: ignore
api_core.check_dependency_versions("google.ads.googleads.v25") # type: ignore
else: # pragma: NO COVER
# An older version of api_core is installed which does not define the
# functions above. We do equivalent checks manually.
try:
import warnings

_py_version_str = sys.version.split()[0]
_package_label = "google.ads.googleads.v25"
if sys.version_info < (3, 10):
warnings.warn(
"You are using a non-supported Python version "
+ f"({_py_version_str}). Google will not post any further "
+ f"updates to {_package_label} supporting this Python version. "
+ "Please upgrade to the latest Python version, or at "
+ f"least to Python 3.10, and then update {_package_label}.",
FutureWarning,
)

def parse_version_to_tuple(version_string: str):
"""Safely converts a semantic version string to a comparable tuple of integers.
Example: "6.33.5" -> (6, 33, 5)
Ignores non-numeric parts and handles common version formats.
Args:
version_string: Version string in the format "x.y.z" or "x.y.z<suffix>"
Returns:
Tuple of integers for the parsed version string.
"""
parts = []
for part in version_string.split("."):
try:
parts.append(int(part))
except ValueError:
# If it's a non-numeric part (e.g., '1.0.0b1' -> 'b1'), stop here.
# This is a simplification compared to 'packaging.parse_version', but sufficient
# for comparing strictly numeric semantic versions.
break
return tuple(parts)

def _get_version(dependency_name):
try:
version_string: str = metadata.version(dependency_name)
parsed_version = parse_version_to_tuple(version_string)
return (parsed_version, version_string)
except Exception:
# Catch exceptions from metadata.version() (e.g., PackageNotFoundError)
# or errors during parse_version_to_tuple
return (None, "--")

_dependency_package = "google.protobuf"
_next_supported_version = "6.33.5"
_next_supported_version_tuple = (6, 33, 5)
_recommendation = " (we recommend 7.x)"
(_version_used, _version_used_string) = _get_version(
_dependency_package
)
if _version_used and _version_used < _next_supported_version_tuple:
warnings.warn(
f"Package {_package_label} depends on "
+ f"{_dependency_package}, currently installed at version "
+ f"{_version_used_string}. Future updates to "
+ f"{_package_label} will require {_dependency_package} at "
+ f"version {_next_supported_version} or higher{_recommendation}."
+ " Please ensure "
+ "that either (a) your Python environment doesn't pin the "
+ f"version of {_dependency_package}, so that updates to "
+ f"{_package_label} can require the higher version, or "
+ "(b) you manually update your Python environment to use at "
+ f"least version {_next_supported_version} of "
+ f"{_dependency_package}.",
FutureWarning,
)
except Exception:
warnings.warn(
"Could not determine the version of Python "
+ "currently being used. To continue receiving "
+ "updates for {_package_label}, ensure you are "
+ "using a supported version of Python; see "
+ "https://devguide.python.org/versions/"
)

__all__ = (
"actions",
"common",
"enums",
"errors",
"resources",
"services",
)
147 changes: 147 additions & 0 deletions google/ads/googleads/v25/actions/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# -*- coding: utf-8 -*-
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
from google.ads.googleads.v25 import gapic_version as package_version

import google.api_core as api_core
import sys

__version__ = package_version.__version__

from importlib import metadata

# PEP 0810: Explicit Lazy Imports
# Python 3.15+ natively intercepts and defers these imports.
# Developers can disable this behavior and force eager imports.
# For more information, see:
# https://docs.python.org/3.15/library/sys.html#sys.set_lazy_imports_filter
# Older Python versions safely ignore this variable.
__lazy_modules__ = {
"google.ads.googleads.v25.types.book_campaigns",
"google.ads.googleads.v25.types.generate_shareable_previews",
"google.ads.googleads.v25.types.quote_campaigns",
}


from .types.book_campaigns import BookCampaignsOperation
from .types.book_campaigns import BookCampaignsResult
from .types.generate_shareable_previews import (
GenerateShareablePreviewsOperation,
)
from .types.generate_shareable_previews import GenerateShareablePreviewsResult
from .types.generate_shareable_previews import ShareablePreview
from .types.generate_shareable_previews import ShareablePreviewResult
from .types.generate_shareable_previews import UiPreviewResult
from .types.generate_shareable_previews import YouTubeLivePreviewResult
from .types.quote_campaigns import QuoteCampaignsOperation
from .types.quote_campaigns import QuoteCampaignsResult

if hasattr(api_core, "check_python_version") and hasattr(
api_core, "check_dependency_versions"
): # pragma: NO COVER
api_core.check_python_version("google.ads.googleads.v25") # type: ignore
api_core.check_dependency_versions("google.ads.googleads.v25") # type: ignore
else: # pragma: NO COVER
# An older version of api_core is installed which does not define the
# functions above. We do equivalent checks manually.
try:
import warnings

_py_version_str = sys.version.split()[0]
_package_label = "google.ads.googleads.v25"
if sys.version_info < (3, 10):
warnings.warn(
"You are using a non-supported Python version "
+ f"({_py_version_str}). Google will not post any further "
+ f"updates to {_package_label} supporting this Python version. "
+ "Please upgrade to the latest Python version, or at "
+ f"least to Python 3.10, and then update {_package_label}.",
FutureWarning,
)

def parse_version_to_tuple(version_string: str):
"""Safely converts a semantic version string to a comparable tuple of integers.
Example: "6.33.5" -> (6, 33, 5)
Ignores non-numeric parts and handles common version formats.
Args:
version_string: Version string in the format "x.y.z" or "x.y.z<suffix>"
Returns:
Tuple of integers for the parsed version string.
"""
parts = []
for part in version_string.split("."):
try:
parts.append(int(part))
except ValueError:
# If it's a non-numeric part (e.g., '1.0.0b1' -> 'b1'), stop here.
# This is a simplification compared to 'packaging.parse_version', but sufficient
# for comparing strictly numeric semantic versions.
break
return tuple(parts)

def _get_version(dependency_name):
try:
version_string: str = metadata.version(dependency_name)
parsed_version = parse_version_to_tuple(version_string)
return (parsed_version, version_string)
except Exception:
# Catch exceptions from metadata.version() (e.g., PackageNotFoundError)
# or errors during parse_version_to_tuple
return (None, "--")

_dependency_package = "google.protobuf"
_next_supported_version = "6.33.5"
_next_supported_version_tuple = (6, 33, 5)
_recommendation = " (we recommend 7.x)"
(_version_used, _version_used_string) = _get_version(
_dependency_package
)
if _version_used and _version_used < _next_supported_version_tuple:
warnings.warn(
f"Package {_package_label} depends on "
+ f"{_dependency_package}, currently installed at version "
+ f"{_version_used_string}. Future updates to "
+ f"{_package_label} will require {_dependency_package} at "
+ f"version {_next_supported_version} or higher{_recommendation}."
+ " Please ensure "
+ "that either (a) your Python environment doesn't pin the "
+ f"version of {_dependency_package}, so that updates to "
+ f"{_package_label} can require the higher version, or "
+ "(b) you manually update your Python environment to use at "
+ f"least version {_next_supported_version} of "
+ f"{_dependency_package}.",
FutureWarning,
)
except Exception:
warnings.warn(
"Could not determine the version of Python "
+ "currently being used. To continue receiving "
+ "updates for {_package_label}, ensure you are "
+ "using a supported version of Python; see "
+ "https://devguide.python.org/versions/"
)

__all__ = (
"BookCampaignsOperation",
"BookCampaignsResult",
"GenerateShareablePreviewsOperation",
"GenerateShareablePreviewsResult",
"QuoteCampaignsOperation",
"QuoteCampaignsResult",
"ShareablePreview",
"ShareablePreviewResult",
"UiPreviewResult",
"YouTubeLivePreviewResult",
)
15 changes: 15 additions & 0 deletions google/ads/googleads/v25/actions/services/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
44 changes: 44 additions & 0 deletions google/ads/googleads/v25/actions/types/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
from .book_campaigns import (
BookCampaignsOperation,
BookCampaignsResult,
)
from .generate_shareable_previews import (
GenerateShareablePreviewsOperation,
GenerateShareablePreviewsResult,
ShareablePreview,
ShareablePreviewResult,
UiPreviewResult,
YouTubeLivePreviewResult,
)
from .quote_campaigns import (
QuoteCampaignsOperation,
QuoteCampaignsResult,
)

__all__ = (
"BookCampaignsOperation",
"BookCampaignsResult",
"GenerateShareablePreviewsOperation",
"GenerateShareablePreviewsResult",
"ShareablePreview",
"ShareablePreviewResult",
"UiPreviewResult",
"YouTubeLivePreviewResult",
"QuoteCampaignsOperation",
"QuoteCampaignsResult",
)
Loading
Loading