'Spend_cap_enabled' AttributeError
Closed this issue · 0 comments
robrechtdr commented
So we do something like the following in our code:
t1 = new_t1(session)
new_properties = {
'advertiser_id': parent_advertiser_id,
'ad_server_id': 3,
'currency_code': campaign['currency_code'],
'frequency_amount': 20,
'frequency_interval': 'week',
'frequency_type': 'asap',
'goal_type': 'cpc',
'goal_value': 10,
'name': campaign['rb_concat_name'],
'service_type': 'SELF',
'override_suspicious_traffic_filter': 1,
'suspicious_traffic_filter_level': 100,
'use_mm_freq': 0,#'off'
'zone_name': 'America/New_York',
'status': 1
'start_date': campaign["start_date"]
'end_date': campaign["end_date"]
'total_budget': campaign["total_budget"]
}
new_campaign = t1.new('campaign')
for _property, value in new_properties.iteritems():
new_campaign.properties[str(_property)] = value
new_campaign.save()
Which results in
Traceback (most recent call last):
File "/apps/automation_api/automation_api/runners.py", line 250, in create_campaigns
new_campaign.save()
File "/apps/automation_api/venv/local/lib/python2.7/site-packages/terminalone/models/campaign.py", line 150, in save
super(Entity, self).__setattr__('_init_sce', self.spend_cap_enabled)
File "/apps/automation_api/venv/local/lib/python2.7/site-packages/terminalone/entity.py", line 80, in __getattr__
raise AttributeError(attribute)
AttributeError: spend_cap_enabled
It looks like the attribute spend_cap_enabled
should always be set on a Campaign
instance but we don't end up setting it for some reason.