Skip to content

Commit 315eefd

Browse files
committed
Fix import statement issues
Change-Id: I596533ebae0749abe06a2c7e6601614e9564c9c5
1 parent c3996b9 commit 315eefd

File tree

7 files changed

+31
-28
lines changed

7 files changed

+31
-28
lines changed

examples/basic_operations/add_ad_groups.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,20 @@
2525

2626
from google.ads.googleads.client import GoogleAdsClient
2727
from google.ads.googleads.errors import GoogleAdsException
28+
from google.ads.googleads.v20.services.services.ad_group_service import (
29+
AdGroupServiceClient,
30+
)
2831
from google.ads.googleads.v20.services.types.ad_group_service import (
2932
AdGroupOperation,
3033
MutateAdGroupsResponse,
31-
AdGroupServiceClient,
3234
)
33-
from google.ads.googleads.v20.services.types.campaign_service import (
35+
from google.ads.googleads.v20.services.services.campaign_service import (
3436
CampaignServiceClient,
3537
)
3638
from google.ads.googleads.v20.resources.types.ad_group import AdGroup
3739

3840

39-
def main(
40-
client: GoogleAdsClient, customer_id: str, campaign_id: str
41-
) -> None:
41+
def main(client: GoogleAdsClient, customer_id: str, campaign_id: str) -> None:
4242
ad_group_service: AdGroupServiceClient = client.get_service(
4343
"AdGroupService"
4444
)
@@ -86,7 +86,9 @@ def main(
8686

8787
# GoogleAdsClient will read the google-ads.yaml configuration file in the
8888
# home directory if none is specified.
89-
googleads_client: GoogleAdsClient = GoogleAdsClient.load_from_storage(version="v20")
89+
googleads_client: GoogleAdsClient = GoogleAdsClient.load_from_storage(
90+
version="v20"
91+
)
9092

9193
try:
9294
main(googleads_client, args.customer_id, args.campaign_id)

examples/basic_operations/add_campaigns.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,24 @@
2626

2727
from google.ads.googleads.client import GoogleAdsClient
2828
from google.ads.googleads.errors import GoogleAdsException
29+
from google.ads.googleads.v20.services.services.campaign_budget_service import (
30+
CampaignBudgetServiceClient,
31+
)
2932
from google.ads.googleads.v20.services.types.campaign_budget_service import (
3033
CampaignBudgetOperation,
31-
CampaignBudgetServiceClient,
3234
MutateCampaignBudgetsResponse,
3335
)
36+
from google.ads.googleads.v20.services.services.campaign_service import (
37+
CampaignServiceClient,
38+
)
3439
from google.ads.googleads.v20.services.types.campaign_service import (
3540
CampaignOperation,
36-
CampaignServiceClient,
3741
MutateCampaignsResponse,
3842
)
3943
from google.ads.googleads.v20.resources.types.campaign_budget import (
4044
CampaignBudget,
4145
)
4246
from google.ads.googleads.v20.resources.types.campaign import Campaign
43-
from google.ads.googleads.v20.common.types.bidding import ManualCpc
4447

4548

4649
_DATE_FORMAT: str = "%Y%m%d"
@@ -69,7 +72,9 @@ def main(client: GoogleAdsClient, customer_id: str) -> None:
6972
# Add budget.
7073
campaign_budget_response: MutateCampaignBudgetsResponse
7174
try:
72-
budget_operations: List[CampaignBudgetOperation] = [campaign_budget_operation]
75+
budget_operations: List[CampaignBudgetOperation] = [
76+
campaign_budget_operation
77+
]
7378
campaign_budget_response = (
7479
campaign_budget_service.mutate_campaign_budgets(
7580
customer_id=customer_id,

examples/basic_operations/get_responsive_search_ads.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
from google.ads.googleads.client import GoogleAdsClient
2626
from google.ads.googleads.errors import GoogleAdsException
27-
from google.ads.googleads.v20.common.types.ad_type_infos import AdTextAsset
27+
from google.ads.googleads.v20.common.types.ad_asset import AdTextAsset
2828
from google.ads.googleads.v20.resources.types.ad import Ad
2929
from google.ads.googleads.v20.services.services.google_ads_service import (
3030
GoogleAdsServiceClient,

examples/basic_operations/pause_ad.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from typing import List
2121

2222
from google.api_core import protobuf_helpers
23+
2324
from google.ads.googleads.client import GoogleAdsClient
2425
from google.ads.googleads.errors import GoogleAdsException
2526
from google.ads.googleads.v20.resources.types.ad_group_ad import AdGroupAd
@@ -56,7 +57,7 @@ def main(
5657
protobuf_helpers.field_mask(None, ad_group_ad._pb),
5758
)
5859

59-
operations List[AdGroupAdOperation] = [ad_group_ad_operation]
60+
operations: List[AdGroupAdOperation] = [ad_group_ad_operation]
6061

6162
ad_group_ad_response: MutateAdGroupAdsResponse = (
6263
ad_group_ad_service.mutate_ad_group_ads(
@@ -92,19 +93,9 @@ def main(
9293

9394
# GoogleAdsClient will read the google-ads.yaml configuration file in the
9495
# home directory if none is specified.
95-
<<<<<<< HEAD
96-
googleads_client: GoogleAdsClient = GoogleAdsClient.load_from_storage(
97-
version="v20"
98-
)
99-
=======
100-
<<<<<<< HEAD
101-
googleads_client = GoogleAdsClient.load_from_storage(version="v20")
102-
=======
10396
googleads_client: GoogleAdsClient = GoogleAdsClient.load_from_storage(
10497
version="v20"
10598
)
106-
>>>>>>> e9e91feee (I've added type hints and annotations to the Python files in your `examples/basic_operations` directory. This should make the code easier to read and also help with static analysis.)
107-
>>>>>>> 6b1491771 (I've added type hints and annotations to the Python files in your `examples/basic_operations` directory. This should make the code easier to read and also help with static analysis.)
10899

109100
try:
110101
main(googleads_client, args.customer_id, args.ad_group_id, args.ad_id)

examples/basic_operations/update_ad_group.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,21 @@
2222
import sys
2323
from typing import List
2424

25+
from google.api_core import protobuf_helpers
26+
2527
from google.ads.googleads.client import GoogleAdsClient
2628
from google.ads.googleads.errors import GoogleAdsException
2729
from google.ads.googleads.v20.resources.types.ad_group import AdGroup
2830
from google.ads.googleads.v20.services.services.ad_group_service import (
2931
AdGroupServiceClient,
3032
)
31-
from google.ads.googleads.v20.services.types.ad_group_ad_service import AdGroupAdOperation
33+
from google.ads.googleads.v20.services.types.ad_group_ad_service import (
34+
AdGroupAdOperation,
35+
)
3236
from google.ads.googleads.v20.services.types.ad_group_service import (
3337
AdGroupOperation,
3438
MutateAdGroupsResponse,
3539
)
36-
from google.api_core import protobuf_helpers
3740

3841

3942
# [START update_ad_group]

examples/basic_operations/update_campaign.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
import sys
2323
from typing import List
2424

25+
from google.api_core import protobuf_helpers
26+
2527
from google.ads.googleads.client import GoogleAdsClient
2628
from google.ads.googleads.errors import GoogleAdsException
2729
from google.ads.googleads.v20.resources.types.campaign import Campaign
@@ -32,7 +34,6 @@
3234
CampaignOperation,
3335
MutateCampaignsResponse,
3436
)
35-
from google.api_core import protobuf_helpers
3637

3738

3839
def main(client: GoogleAdsClient, customer_id: str, campaign_id: str) -> None:

examples/basic_operations/update_responsive_search_ad.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,14 @@
2020

2121
import argparse
2222
import sys
23-
from typing import MutableSequence
23+
from typing import List
2424
from uuid import uuid4
2525

26+
from google.api_core import protobuf_helpers
27+
2628
from google.ads.googleads.client import GoogleAdsClient
2729
from google.ads.googleads.errors import GoogleAdsException
28-
from google.ads.googleads.v20.common.types.ad_type_infos import AdTextAsset
30+
from google.ads.googleads.v20.common.types.ad_asset import AdTextAsset
2931
from google.ads.googleads.v20.resources.types.ad import Ad
3032
from google.ads.googleads.v20.services.services.ad_service import (
3133
AdServiceClient,
@@ -34,7 +36,6 @@
3436
AdOperation,
3537
MutateAdsResponse,
3638
)
37-
from google.api_core import protobuf_helpers
3839

3940

4041
# [START update_responsive_search_ad]

0 commit comments

Comments
 (0)