google adwords python api - how to get ad group bid -
i using adwords python api. need bid amount , type. e.g. bid=4 ad type = cpc.
i given adgroup id.
below example on create , ad group. once created...how retrieve settings? how e.g. bid set?
ad_group_service = client.getservice('adgroupservice', version='v201402') operations = [{ 'operator': 'add', 'operand': { 'campaignid': campaign_id, 'name': 'earth mars cruises #%s' % uuid.uuid4(), 'status': 'enabled', 'biddingstrategyconfiguration': { 'bids': [ { 'xsi_type': 'cpcbid', 'bid': { 'microamount': '1000000' }, } ] } } }] ad_groups = ad_group_service.mutate(operations)
have @ corresponding example on googlads
's github page.
basically you'll user adgroupservice
's get
method selector containing right fields , predicates retrieve adgrouppage
containing adgroup
objects you're interested in:
selector = { 'fields': ['id', 'name', 'cpcbid'], 'predicates': [ { 'field': 'id', 'operator': 'equals', 'values': [given_adgroup_id] } ] } page = adgroup_service.get(selector) adgroup = page.entries[0] print('adgroup "%s" (%s) has cpc %s' % (adgroup.name, adgroup.id, adgroup.biddingstrategyconfiguration.bids.bid))
the available fields' names , attributes populate in returned objects can found @ selector reference page. adgroupservice
's reference page might of interest.
Comments
Post a Comment