Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'Text' object has no attribute 'Campaign' #267

Open
nbro10 opened this issue Jan 3, 2024 · 0 comments
Open

AttributeError: 'Text' object has no attribute 'Campaign' #267

nbro10 opened this issue Jan 3, 2024 · 0 comments

Comments

@nbro10
Copy link

nbro10 commented Jan 3, 2024

We've been getting this error for quite some time.

Specifically, we make the following request

...
result = campaign_service.GetCampaignsByAccountId(
            AccountId=account_id,
            CampaignType=CAMPAIGN_TYPES,
            ReturnAdditionalFields=['CpvCpmBiddingScheme'],
        )
...

And then do the following

...
records = ((str(cc.Name), int(cc.Id)) for cc in result.Campaign)
...

which is the line that triggers the error in the title.

Now, according to the documentation, result should be an array of Campaign objects or an empty array if there are no campaigns, so what we're doing should always work, unless the documentation is outdated. In that case, can you please tell us what are all the types that may be returned by GetCampaignsByAccountId, when they are returned and any recommendation on how to handle all the cases.

By looking at the logs, result seems to be an empty string, although I think this is just how the Text object is printed (because the error message says it's Text object not str. If look at the account for which we are trying to get the campaigns, it seems it has no campaign (at least, I can't see any in the UI).

So, can you confirm that this happens when the account has no campaigns, and that this is a bug in this package? In any case, I think this package should return an empty list instead of an empty string or Text in that case.

Thanks.

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

No branches or pull requests

1 participant