Skip to content

Commit 11a6b85

Browse files
committed
AdWords v201809 release.
1 parent d281383 commit 11a6b85

File tree

118 files changed

+13262
-70
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+13262
-70
lines changed

ChangeLog

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1+
14.1.0 -- 09/21/18
2+
* Added support and examples for AdWords v201809.
3+
* Resolved issues:
4+
- Issue 281: https://github.com/googleads/googleads-python-lib/issues/281
5+
16
14.0.0 -- 08/21/18
2-
- DFP rebranded to Google Ad Manager.
3-
- Google Ad Manager v201808 release.
4-
- Removed support for DFP v201708.
5-
- Removed examples for DFP v201711.
7+
* DFP rebranded to Google Ad Manager.
8+
* Google Ad Manager v201808 release.
9+
* Removed support for DFP v201708.
10+
* Removed examples for DFP v201711.
611

712
13.0.0 -- 07/25/18
8-
- Removed support for AdWords v201710.
13+
* Removed support for AdWords v201710.
914

1015
12.2.0 -- 06/18/18
11-
- Fixed some DFP examples that would loop forever with Zeep.
16+
* Fixed some DFP examples that would loop forever with Zeep.
1217

1318
12.1.0 -- 06/06/18
1419
* Added support and examples for AdWords v201806.

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,10 @@ If you have issues directly related to the client library, use the [issue
9494
tracker](https://github.com/googleads/googleads-python-lib/issues).
9595

9696

97-
If you have issues pertaining to a specific product, use the product support forums:
97+
If you have issues pertaining to a specific API, use the product support forums:
9898

9999
* [AdWords](https://groups.google.com/forum/#!forum/adwords-api)
100-
* [DoubleClick for Publishers](https://groups.google.com/forum/#!forum/google-doubleclick-for-publishers-api)
101-
102-
Make sure to subscribe to our [Google Plus page](https://plus.google.com/+GoogleAdsDevelopers)
103-
for API change announcements and other news.
100+
* [Ad Manager](https://groups.google.com/forum/#!forum/google-doubleclick-for-publishers-api)
104101

105102

106103
## How do I log SOAP interactions?

examples/adwords/v201802/account_management/create_account.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,7 @@ def main(client):
4444
'name': 'Account created with ManagedCustomerService on %s' % today,
4545
'currencyCode': 'EUR',
4646
'dateTimeZone': 'Europe/London',
47-
},
48-
# For whitelisted users only, uncomment the inviteeEmail and inviteeRole
49-
# attributes to invite a user to have access to an account on an ADD. An
50-
# email will be sent inviting the user to have access to the newly created
51-
# account.
52-
# 'inviteeEmail': '[email protected]',
53-
# 'inviteeRole': 'ADMINISTRATIVE'
47+
}
5448
}]
5549

5650
# Create the account. It is possible to create multiple accounts with one

examples/adwords/v201806/account_management/create_account.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,7 @@ def main(client):
4444
'name': 'Account created with ManagedCustomerService on %s' % today,
4545
'currencyCode': 'EUR',
4646
'dateTimeZone': 'Europe/London',
47-
},
48-
# For whitelisted users only, uncomment the inviteeEmail and inviteeRole
49-
# attributes to invite a user to have access to an account on an ADD. An
50-
# email will be sent inviting the user to have access to the newly created
51-
# account.
52-
# 'inviteeEmail': '[email protected]',
53-
# 'inviteeRole': 'ADMINISTRATIVE'
47+
}
5448
}]
5549

5650
# Create the account. It is possible to create multiple accounts with one
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2016 Google Inc. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""Examples for AdWords."""
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2016 Google Inc. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""Account management examples."""
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/usr/bin/env python
2+
#
3+
# Copyright 2016 Google Inc. All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
"""This example accepts a pending Google Merchant Center invitation link.
18+
19+
The LoadFromStorage method is pulling credentials and properties from a
20+
"googleads.yaml" file. By default, it looks for this file in your home
21+
directory. For more information, see the "Caching authentication information"
22+
section of our README.
23+
24+
"""
25+
26+
27+
from googleads import adwords
28+
29+
30+
SERVICE_LINK_ID = 'INSERT_SERVICE_LINK_ID_HERE'
31+
32+
33+
def main(client, service_link_id):
34+
# Initialize appropriate service.
35+
customer_service = client.GetService(
36+
'CustomerService', version='v201809')
37+
38+
# Create the operation to set the status to ACTIVE.
39+
operations = [{
40+
'operator': 'SET',
41+
'operand': {
42+
'serviceLinkId': service_link_id,
43+
'serviceType': 'MERCHANT_CENTER',
44+
'linkStatus': 'ACTIVE',
45+
}
46+
}]
47+
48+
# Update the service link.
49+
mutated_service_links = customer_service.mutateServiceLinks(operations)
50+
51+
# Display results.
52+
for mutated_service_link in mutated_service_links:
53+
print ('Service link with service link ID "%s", type "%s" was updated '
54+
'to status: "%s".' % (mutated_service_link['serviceLinkId'],
55+
mutated_service_link['serviceType'],
56+
mutated_service_link['linkStatus']))
57+
58+
59+
if __name__ == '__main__':
60+
# Initialize client object.
61+
adwords_client = adwords.AdWordsClient.LoadFromStorage()
62+
main(adwords_client, SERVICE_LINK_ID)
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/usr/bin/env python
2+
#
3+
# Copyright 2016 Google Inc. All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
"""This example illustrates how to create an account.
18+
19+
Note by default this account will only be accessible via its parent AdWords
20+
manager account..
21+
22+
The LoadFromStorage method is pulling credentials and properties from a
23+
"googleads.yaml" file. By default, it looks for this file in your home
24+
directory. For more information, see the "Caching authentication information"
25+
section of our README.
26+
27+
"""
28+
29+
30+
from datetime import datetime
31+
from googleads import adwords
32+
33+
34+
def main(client):
35+
# Initialize appropriate service.
36+
managed_customer_service = client.GetService(
37+
'ManagedCustomerService', version='v201809')
38+
39+
today = datetime.today().strftime('%Y%m%d %H:%M:%S')
40+
# Construct operations and add campaign.
41+
operations = [{
42+
'operator': 'ADD',
43+
'operand': {
44+
'name': 'Account created with ManagedCustomerService on %s' % today,
45+
'currencyCode': 'EUR',
46+
'dateTimeZone': 'Europe/London',
47+
}
48+
}]
49+
50+
# Create the account. It is possible to create multiple accounts with one
51+
# request by sending an array of operations.
52+
accounts = managed_customer_service.mutate(operations)
53+
54+
# Display results.
55+
for account in accounts['value']:
56+
print ('Account with customer ID "%s" was successfully created.'
57+
% account['customerId'])
58+
59+
60+
if __name__ == '__main__':
61+
# Initialize client object.
62+
adwords_client = adwords.AdWordsClient.LoadFromStorage()
63+
main(adwords_client)
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
#!/usr/bin/env python
2+
#
3+
# Copyright 2016 Google Inc. All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
"""This example gets the changes in the account during the last 24 hours.
18+
19+
The LoadFromStorage method is pulling credentials and properties from a
20+
"googleads.yaml" file. By default, it looks for this file in your home
21+
directory. For more information, see the "Caching authentication information"
22+
section of our README.
23+
24+
"""
25+
26+
27+
import datetime
28+
from googleads import adwords
29+
30+
31+
def main(client):
32+
# Initialize appropriate service.
33+
customer_sync_service = client.GetService(
34+
'CustomerSyncService', version='v201809')
35+
campaign_service = client.GetService('CampaignService', version='v201809')
36+
37+
# Construct selector and get all campaigns.
38+
selector = {
39+
'fields': ['Id', 'Name', 'Status']
40+
}
41+
campaigns = campaign_service.get(selector)
42+
campaign_ids = []
43+
if 'entries' in campaigns:
44+
for campaign in campaigns['entries']:
45+
campaign_ids.append(campaign['id'])
46+
else:
47+
print 'No campaigns were found.'
48+
return
49+
50+
# Construct selector and get all changes.
51+
today = datetime.datetime.today()
52+
yesterday = today - datetime.timedelta(1)
53+
selector = {
54+
'dateTimeRange': {
55+
'min': yesterday.strftime('%Y%m%d %H%M%S'),
56+
'max': today.strftime('%Y%m%d %H%M%S')
57+
},
58+
'campaignIds': campaign_ids
59+
}
60+
account_changes = customer_sync_service.get(selector)
61+
62+
# Display results.
63+
if account_changes:
64+
if 'lastChangeTimestamp' in account_changes:
65+
print 'Most recent changes: %s' % account_changes['lastChangeTimestamp']
66+
if account_changes['changedCampaigns']:
67+
for data in account_changes['changedCampaigns']:
68+
print ('Campaign with id "%s" has change status "%s".'
69+
% (data['campaignId'], data['campaignChangeStatus']))
70+
if (data['campaignChangeStatus'] != 'NEW' and
71+
data['campaignChangeStatus'] != 'FIELDS_UNCHANGED'):
72+
if 'addedCampaignCriteria' in data:
73+
print (' Added campaign criteria: %s' %
74+
data['addedCampaignCriteria'])
75+
if 'removedCampaignCriteria' in data:
76+
print (' Removed campaign criteria: %s' %
77+
data['removedCampaignCriteria'])
78+
if 'changedAdGroups' in data:
79+
for ad_group_data in data['changedAdGroups']:
80+
print (' Ad group with id "%s" has change status "%s".'
81+
% (ad_group_data['adGroupId'],
82+
ad_group_data['adGroupChangeStatus']))
83+
if ad_group_data['adGroupChangeStatus'] != 'NEW':
84+
if 'changedAds' in ad_group_data:
85+
print ' Changed ads: %s' % ad_group_data['changedAds']
86+
if 'changedCriteria' in ad_group_data:
87+
print (' Changed criteria: %s' %
88+
ad_group_data['changedCriteria'])
89+
if 'removedCriteria' in ad_group_data:
90+
print (' Removed criteria: %s' %
91+
ad_group_data['removedCriteria'])
92+
else:
93+
print 'No changes were found.'
94+
95+
96+
if __name__ == '__main__':
97+
# Initialize client object.
98+
adwords_client = adwords.AdWordsClient.LoadFromStorage()
99+
main(adwords_client)

0 commit comments

Comments
 (0)