Hello Sir,

I am trying to set the budget at the  campaign level taking values from the 
json file but getting and error GoogleAdsServerFault: Unmarshalling Error: 
For input string: "r" 

My code is:

def main(client): campaign_service = client.GetService('CampaignService', 
version='v201809') budget_service = client.GetService('BudgetService', 
version='v201809') for i in my_json_data.keys(): for j in 
my_json_data[str(i)].keys(): k=str(j) q=my_json_data[str(i)][j]['Total 
Suggested Daily Budget'] D = decimal.Decimal r=D(q) r=str(r) budget = { 
'name':k+'budget', 'amount':{ 'microAmount': 'r' }, 'deliveryMethod': 
'STANDARD' } budget_operations = [{ 'operator': 'ADD', 'operand': budget }] 
budget_id = 
budget_service.mutate(budget_operations)['value'][0]['budgetId'] operations 
= [{ 'operator': 'ADD', 'operand':{ 'name':k, 'status': 'PAUSED', 
'advertisingChannelType': 'SEARCH', 'biddingStrategyConfiguration':{ 
'biddingStrategyType': 'MANUAL_CPC', }, 'endDate': (datetime.datetime.now() 
+ datetime.timedelta(365)).strftime('%Y%m%d'), 'budget':{ 'budgetId': 
budget_id }, 'networkSetting':{ 'targetGoogleSearch': 'true', 
'targetSearchNetwork': 'true', 'targetContentNetwork': 'false', 
'targetPartnerSearchNetwork': 'false' }, 'startDate': 
(datetime.datetime.now() + datetime.timedelta(1)).strftime('%Y%m%d'), 
'frequencyCap':{ 'impressions': '5', 'timeUnit': 'DAY', 'level': 'ADGROUP' 
}, 'settings':[ { 'xsi_type': 'GeoTargetTypeSetting', 
'positiveGeoTargetType': 'DONT_CARE', 'negativeGeoTargetType': 'DONT_CARE' 
} ] } },] campaigns = campaign_service.mutate(operations) for campaign in 
campaigns['value']: print ('Campaign with name "%s" and id "%s" was added.' 
% (campaign['name'], campaign['id'])) if __name__ == '__main__': # 
Initialize client object. adwords_client = 
adwords.AdWordsClient.LoadFromStorage() main(adwords_client)


Please help out me with some solution.

Thanks and Regards,
Abhay

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/1760c2e9-7031-4728-bf57-bd8c9e22acea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • Regardi... Abhay Desale
    • RE... googleadsapi-forumadvisor via AdWords API and Google Ads API Forum

Reply via email to