Skip to content

Commit 97a6dba

Browse files
committed
AdWords v201502 release.
1 parent 076278c commit 97a6dba

File tree

114 files changed

+8654
-187
lines changed

Some content is hidden

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

114 files changed

+8654
-187
lines changed

ChangeLog

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
3.2.0 - 3/12/2015
2+
* Added support for v201502 of the AdWords Client Library.
3+
* Removed CampaignAdExtensionService (from v201502).
4+
* Added AccountLabelService (to v201502)
5+
* Added hard feed types examples, moved to new "extensions" examples.
6+
* Added example for shared sets.
7+
* Minor fixes to reporting examples.
8+
* Updated some existing samples for new API version.
9+
* DFP clients now require you to set an application name.
10+
111
3.1.1 - 2/25/2015
212
* Added new example for migrating to Upgraded URLS.
313
* Updated examples to reference final URLs.

examples/adwords/v201406/reporting/download_criteria_report_as_stream.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def main(client):
6262

6363
try:
6464
while True:
65-
chunk = stream_data.read(adwords._CHUNK_SIZE)
65+
chunk = stream_data.read(adwords.CHUNK_SIZE)
6666
if not chunk: break
6767
report_data.write(chunk.decode() if sys.version_info[0] == 3
6868
and getattr(report_data, 'mode', 'w') == 'w' else chunk)

examples/adwords/v201406/reporting/download_criteria_report_as_stream_with_awql.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def main(client):
6363

6464
try:
6565
while True:
66-
chunk = stream_data.read(adwords._CHUNK_SIZE)
66+
chunk = stream_data.read(adwords.CHUNK_SIZE)
6767
if not chunk: break
6868
report_data.write(chunk.decode() if sys.version_info[0] == 3
6969
and getattr(report_data, 'mode', 'w') == 'w' else chunk)

examples/adwords/v201409/account_management/create_account.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
"""This example illustrates how to create an account.
1818
19-
Note by default this account will only be accessible via parent MCC.
19+
By default this account will only be accessible via parent MCC.
2020
2121
The LoadFromStorage method is pulling credentials and properties from a
2222
"googleads.yaml" file. By default, it looks for this file in your home

examples/adwords/v201409/advanced_operations/update_site_links.py

Lines changed: 0 additions & 168 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2015 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+
"""Extension examples."""
Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@
4545
# "https://www.google.com/local/add".
4646
GMB_ACCESS_TOKEN = 'INSERT_GMB_OAUTH_ACCESS_TOKEN_HERE'
4747

48+
# If the gmb_email_address above is for a GMB manager instead of
49+
# the GMB account owner, then set business_account_identifier to the
50+
# +Page ID of a location for which the manager has access. See the
51+
# location extensions guide at
52+
# https://developers.google.com/adwords/api/docs/guides/feed-services-locations
53+
# for details.
54+
BUSINESS_ACCOUNT_IDENTIFIER = None
55+
4856
# The placeholder type for location extensions.
4957
# See the Placeholder reference page for a list of all the placeholder types
5058
# and fields:
@@ -56,18 +64,19 @@
5664
MAX_CUSTOMER_FEED_ADD_ATTEMPTS = 10
5765

5866

59-
def main(client, gmb_email_address, gmb_access_token):
67+
def main(client, gmb_email_address, gmb_access_token,
68+
business_account_identifier=None):
6069
# Create a feed that will sync to the Google Places account specified by
6170
# gmb_email_address. Do not add FeedAttributes to this object,
6271
# as AdWords will add them automatically because this will be a
6372
# system generated feed.
6473
feed = {
65-
'name': 'Places feed #%s' % uuid.uuid4(),
74+
'name': 'GMB feed #%s' % uuid.uuid4(),
6675
'systemFeedGenerationData': {
6776
'xsi_type': 'PlacesLocationFeedData',
6877
'oAuthInfo': {
6978
'httpMethod': 'GET',
70-
'httpRequestUrl': 'https://www.google.com/local/add',
79+
'httpRequestUrl': 'https://www.googleapis.com/auth/adwords',
7180
'httpAuthorizationHeader': 'Bearer %s' % gmb_access_token
7281
},
7382
'emailAddress': gmb_email_address,
@@ -77,6 +86,12 @@ def main(client, gmb_email_address, gmb_access_token):
7786
'origin': 'ADWORDS'
7887
}
7988

89+
# Only include the business_account_identifier if it's specified.
90+
if business_account_identifier:
91+
feed['systemFeedGenerationData']['businessAccountIdentifier'] = (
92+
business_account_identifier
93+
)
94+
8095
# Create an operation to add the feed.
8196
gmb_operations = [{
8297
'operator': 'ADD',
@@ -93,10 +108,11 @@ def main(client, gmb_email_address, gmb_access_token):
93108
customer_feed = {
94109
'feedId': added_feed['id'],
95110
'placeholderTypes': [PLACEHOLDER_LOCATION],
111+
# Create a matching function that will always evaluate to True.
96112
'matchingFunction': {
97113
'operator': 'IDENTITY',
98114
'lhsOperand': {
99-
'xsi_type': 'FunctionArgumentOperand',
115+
'xsi_type': 'ConstantOperand',
100116
'type': 'BOOLEAN',
101117
'booleanValue': True
102118
}
@@ -123,6 +139,7 @@ def main(client, gmb_email_address, gmb_access_token):
123139
sleep_seconds = 2 ** i
124140
print ('Attempt %d to add the CustomerFeed was not successful.'
125141
'Waiting %d seconds before trying again.\n' % (i, sleep_seconds))
142+
126143
time.sleep(sleep_seconds)
127144
i += 1
128145

@@ -137,4 +154,5 @@ def main(client, gmb_email_address, gmb_access_token):
137154
if __name__ == '__main__':
138155
# Initialize client object.
139156
adwords_client = adwords.AdWordsClient.LoadFromStorage()
140-
main(adwords_client, GMB_EMAIL_ADDRESS, GMB_ACCESS_TOKEN)
157+
main(adwords_client, GMB_EMAIL_ADDRESS, GMB_ACCESS_TOKEN,
158+
BUSINESS_ACCOUNT_IDENTIFIER)

0 commit comments

Comments
 (0)