"AttributeError: 'int' object has no attribute 'name'" when I'm trying to get enum's name

1,219 views
Skip to first unread message

Vladimir Potter

unread,
Nov 19, 2021, 12:57:59 PM11/19/21
to AdWords API and Google Ads API Forum
Hello there,

Could someone please show me the right way to get enum's name?

>>> campaign = client.get_type("Campaign")
>>> campaign.status = client.enums.CampaignStatusEnum.PAUSED
>>> campaign.status.name
---------------------------------------------------------------------------
AttributeError: 'int' object has no attribute 'name'

I'm using python client, googleads-api==14.1.0 and Ads API v9

Best regards,
Vladimir

Google Ads API Forum Advisor

unread,
Nov 22, 2021, 1:19:38 AM11/22/21
to vladimi...@regiohelden.de, adwor...@googlegroups.com
Hi Vladimir,

Thank you for reaching out to our team.

I completely understand the issue, however, the issue appears more specific with the Python client library. With this, I would suggest reaching out to the author of the Python client library via this link as they are more equipped to provide support to this issue.

Regards,

Reminder: Share your feedback about the Google Ads (AdWords) API! Take the 2021 Google Ads API and AdWords API Annual Survey
 
Google Logo
Ernie John Blanca Tacata
Google Ads API Team
 


ref:_00D1U1174p._5004Q2RujbX:ref

Vladimir Potter

unread,
Nov 22, 2021, 5:01:12 AM11/22/21
to AdWords API and Google Ads API Forum
Hi Ernie,

Thanks a lot! After careful reading of the changelog for python api client, I've found the solution to my problem

Previous behavior of the python client was changed by this:
"Version 14.0.0 of this library introduced the required use_proto_plus configuration option that specifies which type of protobuf message to use."

use_proto_plus is set to False by default which make the client to return protobuf objects instead of proto-plus. More info on their differences can be found here: https://developers.google.com/google-ads/api/docs/client-libs/python/protobuf-messages

Best regards,
Vladimir

Google Ads API Forum Advisor

unread,
Nov 22, 2021, 3:58:59 PM11/22/21
to vladimi...@regiohelden.de, adwor...@googlegroups.com
Hi Vladimir,

Thank you for reporting back to us that use_proto_plus is set to False in the client library fixed the issue. Is there anything else Ads API related you need assistance with?


Reminder: Share your feedback about the Google Ads (AdWords) API! Take the 2021 Google Ads API and AdWords API Annual Survey
 
Regards,
Google Logo
Aryeh Baker
Google Ads API Team
 


ref:_00D1U1174p._5004Q2RujbX:ref

Xinyi Guo

unread,
Jan 3, 2023, 10:25:14 PM1/3/23
to Google Ads API and AdWords API Forum
Just encountered the same issue and I set the use_proto_plus to TRUE for solving the problem, not FALSE.

Best,
Corrine

Google Ads API Forum Advisor

unread,
Jan 4, 2023, 8:24:17 AM1/4/23
to guom...@gmail.com, adwor...@googlegroups.com

Hi Corrine,

Thank you for your reply. Thanks for updating us on the said issue that it resolved by setting the use_proto_plus to TRUE, and not FALSE. Thank you for validating this. However, if you wish to validate this with client library owner, then you may create new issue here as well.

Regards,

Google Logo
Yasar
Google Ads API Team
 


ref:_00D1U1174p._5004Q2RujbX:ref
Reply all
Reply to author
Forward
0 new messages