Hi,
Thank you for reaching out.
To filter LabelId in your request, you would need to include a predicate
for your LabelId. You may refer to this guide
<https://developers.google.com/adwords/api/docs/reference/v201809/CampaignService.Campaign#labels>
on how to set the LabelIds as a predicate. For the Python code
implementation, you could use this sample code
<https://developers.google.com/adwords/api/docs/samples/python/basic-operations#update-a-campaign>
(for
updating a campaign) as a reference. You could also open your concern to
the client library owners in the Python GitHub via this link
<https://github.com/googleads/googleads-python-lib/issues> as the client
library owners will be able to assist you better.
Regards,
Dannison
Google Ads API Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
https://ads-developers.googleblog.com/search/label/google_ads_api
https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
On 04/17/19 16:13:28 [email protected] wrote:
Im new to using AdWords API with Python, and Im trying to make some simple
tasks such as pausing a campign vased on the label id, but its not working.
Hoping for some help please;
#!/usr/bin/env python
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""This example updates a campaign by setting its status to PAUSED.
To get campaigns, run get_campaigns.py.
The LoadFromStorage method is pulling credentials and properties from a
"googleads.yaml" file. By default, it looks for this file in your home
directory. For more information, see the "Caching authentication
information"
section of our README.
"""
from googleads import adwords
LABEL_ID = 'XXXXXXXXX'
def main(client, label_id):
# Initialize appropriate service.
campaign_service = client.GetService('CampaignService', version='v201809')
# Construct operations and update campaign.
operations = [{
'operator': 'SET',
'operand': {
'labelids': label_id,
'status': 'PAUSED'
}
}]
campaigns = campaign_service.mutate(operations)
# Display results.
for campaign in campaigns['value']:
print ('Campaign with name "%s" and id "%s" was updated.'
% (campaign['name'], campaign['labelids']))
if __name__ == '__main__':
# Initialize client object.
adwords_client = adwords.AdWordsClient.LoadFromStorage()
main(adwords_client, LABEL_ID)
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/9376884c-7fd0-42b3-87ca-e7df5f3d0247%40googlegroups.com
<https://groups.google.com/d/msgid/adwords-api/9376884c-7fd0-42b3-87ca-e7df5f3d0247%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/180pngg00000000180q896002os9gux6gmj8cpn68o30c1g68r36chk%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.