googleads / google-ads-python

Google Ads API Client Library for Python
Apache License 2.0
504 stars 477 forks source link

Not able to export bidding_strategy.type in csv #606

Closed AashisAashu closed 2 years ago

AashisAashu commented 2 years ago

*Describe the bug:I am not able to export the values of bidding_strategy.type in csb using the code examples/migration/campaign_report_to_csv.py. Got the error as AttributeError: type*

*Steps to Reproduce:Add the column bidding_strategy.type in select part of the code.BiddingStrategyType in Headers and row.bidding_strategy.type in writer.writerow part. Run the code. Got the error as AttributeError: type*

*Expected behavior: The code should be able to export the value of bidding_strategy.type in csv without error*

Client library version and API version: Client library version: Google Ads API version:

Request/Response Logs:

Anything else we should know about your project / environment:

BenRKarl commented 2 years ago

@AashisAashu assuming you have use_proto_plus set to True, some field names must be appended with a _ character, specifically you likely need to change:

bidding_strategy.type

to:

bidding_strategy.type_

For more details see this documentation

AashisAashu commented 2 years ago

Thanks @BenRKarl Your solution worked. I made the changes in yaml file to set use_proto_plus: "True" and then while writing the data to csv using csv.writter i used the row.biddingstrategy.type