Update examples to use v26 by BenRKarl · Pull Request #1097 · googleads/google-ads-python · GitHub
Skip to content

Update examples to use v26 - #1097

Open
BenRKarl wants to merge 1 commit into
mainfrom
examples_to_latest
Open

BenRKarl wants to merge 1 commit into
mainfrom
examples_to_latest

Conversation

@BenRKarl

Copy link
Copy Markdown
Contributor

No description provided.

@BenRKarl
BenRKarl requested a review from a team as a code owner October 20, 2026 15:48
@BenRKarl
BenRKarl requested review from Raibaz and sundquist October 20, 2026 15:48
@BenRKarl BenRKarl added the kokoro:run This label is required to run a kokoro presubmit if an external contributor sends a PR. label Oct 20, 2026
@BenRKarl
BenRKarl requested review from bobhancockg and removed request for sundquist October 20, 2026 15:49
@kokoro-team kokoro-team removed the kokoro:run This label is required to run a kokoro presubmit if an external contributor sends a PR. label Oct 20, 2026
Comment on lines +40 to 43

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SearchPagedResponse does not exist in google.ads.googleads.v26.services.types.google_ads_service and raises an ImportError at runtime. GoogleAdsServiceClient.search() returns a SearchPager:

Suggested change
from google.ads.googleads.v26.services.types.google_ads_service import (
SearchPagedResponse,
GoogleAdsRow,
)
from google.ads.googleads.v26.services.services.google_ads_service.pagers import (
SearchPager,
)
from google.ads.googleads.v26.services.types.google_ads_service import (
GoogleAdsRow,
)

Comment on lines +34 to 38
from google.ads.googleads.v26.services.types.google_ads_service import (
SearchGoogleAdsRequest,
SearchPagedResponse,
GoogleAdsRow,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SearchPagedResponse does not exist in google.ads.googleads.v26.services.types.google_ads_service and raises an ImportError at runtime. Import SearchPager from google.ads.googleads.v26.services.services.google_ads_service.pagers instead:

Suggested change
from google.ads.googleads.v26.services.types.google_ads_service import (
SearchGoogleAdsRequest,
SearchPagedResponse,
GoogleAdsRow,
)
from google.ads.googleads.v26.services.services.google_ads_service.pagers import (
SearchPager,
)
from google.ads.googleads.v26.services.types.google_ads_service import (
SearchGoogleAdsRequest,
GoogleAdsRow,
)

Comment on lines +27 to 31
from google.ads.googleads.v26.services.types.google_ads_service import (
SearchGoogleAdsRequest,
SearchPagedResponse,
GoogleAdsRow,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SearchPagedResponse does not exist in google.ads.googleads.v26.services.types.google_ads_service and raises an ImportError at runtime. Import SearchPager from google.ads.googleads.v26.services.services.google_ads_service.pagers instead:

Suggested change
from google.ads.googleads.v26.services.types.google_ads_service import (
SearchGoogleAdsRequest,
SearchPagedResponse,
GoogleAdsRow,
)
from google.ads.googleads.v26.services.services.google_ads_service.pagers import (
SearchPager,
)
from google.ads.googleads.v26.services.types.google_ads_service import (
SearchGoogleAdsRequest,
GoogleAdsRow,
)

Comment on lines +38 to 41
from google.ads.googleads.v26.services.types.google_ads_service import (
SearchPagedResponse,
GoogleAdsRow,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SearchPagedResponse does not exist in google.ads.googleads.v26.services.types.google_ads_service and raises an ImportError at runtime. Import SearchPager from google.ads.googleads.v26.services.services.google_ads_service.pagers instead.

Also note: MutateCustomerClientLinkResponse (imported on line 30) has a singular .result field in v26 rather than .results, so response.results[0].resource_name on line 86 will raise an AttributeError (should be response.result.resource_name).

Comment on lines +32 to 35
from google.ads.googleads.v26.services.types.google_ads_service import (
SearchGoogleAdsRequest,
SearchPagedResponse,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SearchPagedResponse does not exist in google.ads.googleads.v26.services.types.google_ads_service and raises an ImportError at runtime. Import SearchPager from google.ads.googleads.v26.services.services.google_ads_service.pagers instead:

Suggested change
from google.ads.googleads.v26.services.types.google_ads_service import (
SearchGoogleAdsRequest,
SearchPagedResponse,
)
from google.ads.googleads.v26.services.services.google_ads_service.pagers import (
SearchPager,
)
from google.ads.googleads.v26.services.types.google_ads_service import (
SearchGoogleAdsRequest,
)

GoogleAdsServiceClient,
)
from google.ads.googleads.v24.services.types import *
from google.ads.googleads.v26.services.types import *

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid wildcard imports (import *) per the Google Python Style Guide, especially on services.types which loads hundreds of protobuf classes into the module namespace. Explicitly import the operation/response types used in this example instead.

Comment on lines +79 to 82
from google.ads.googleads.v26.services.types.google_ads_service import (
MutateGoogleAdsResponse,
MutateOperation,
MutateOperationResponse,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MutateOperationResponse is imported here but unused in this file.


from google.protobuf import field_mask_pb2
from google.ads.googleads.v24.resources.types import youtube_video_upload
from google.ads.googleads.v26.resources.types import youtube_video_upload

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

youtube_video_upload (line 52), GoogleAdsRow (line 35), and UpdateYouTubeVideoUploadRequest / UpdateYouTubeVideoUploadResponse / RemoveYouTubeVideoUploadRequest / RemoveYouTubeVideoUploadResponse (lines 45–48) are unused in this file and can be removed.

Comment on lines +27 to 29
from google.ads.googleads.v26.services.types.google_ads_service import (
GoogleAdsRow,
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GoogleAdsRow is imported here but unused in this file.

Comment on lines +27 to 29

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GoogleAdsRow is imported here but unused in this file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants