Skip to content

Commit 7f57534

Browse files
committed
5.0.0 release, fixing various bugs and enable SOAP gzip compression.
1 parent 6138ea7 commit 7f57534

23 files changed

Lines changed: 575 additions & 98 deletions

File tree

ChangeLog

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
5.0.0 -- 1/13/17:
2+
* BREAKING CHANGE: The underlying suds client now has cache enabled. By default,
3+
suds uses FileCache which requires access to local file system and will break
4+
users using Google App Engine. For more details on how to configure or disable
5+
caching, see the README.
6+
* The library will now automatically apply a monkey patch to the suds-jurko
7+
dependency on initialization that will modify the suds.transport.http module.
8+
The patch modifies HttpTransport's send method such that it can detect and
9+
decompress a gzip encoded SOAP body.
10+
* Added new "enable_compression" optional keyword argument for AdWordsClient and
11+
DfpClient. If set True, the client will request gzip compression and
12+
automatically decompress the SOAP body for you. For more details on this
13+
feature, see:
14+
https://developers.google.com/adwords/api/docs/guides/bestpractices?hl=en#use_compression
15+
* Resolved issues:
16+
Issue 77: https://github.com/googleads/googleads-python-lib/issues/77
17+
Issue 97: https://github.com/googleads/googleads-python-lib/issues/97
18+
* Resolved pull requests:
19+
PR 79: https://github.com/googleads/googleads-python-lib/pull/79
20+
PR 81: https://github.com/googleads/googleads-python-lib/pull/81
21+
PR 91: https://github.com/googleads/googleads-python-lib/pull/91
22+
PR 99: https://github.com/googleads/googleads-python-lib/pull/99
23+
124
4.8.0 -- 11/29/16:
225
* Added support for DFP v201611.
326
* Removed support for DFP v201508 and v201511.

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,31 @@ suds_client.set_options(
162162
suds_client.service.mutate([operation])
163163
```
164164

165+
##How can I configure or disable caching for the suds client?
166+
167+
By default, the suds clients are cached because reading and digesting the WSDL
168+
can be expensive. However, the default caching method requires permission to
169+
access a local file system that may not be available in certain hosting
170+
environments such as App Engine.
171+
172+
You can pass an implementation of `suds.cache.Cache` to the `AdWordsClient` or
173+
`DfpClient` initializer to modify the default caching behavior.
174+
175+
For example, configuring a different location and duration of the cache file:
176+
```python
177+
file_cache = suds.cache.FileCache(location=cache_path, days=2)
178+
adwords_client = adwords.AdWordsClient(
179+
developer_token, oauth2_client, user_agent,
180+
client_customer_id=client_customer_id, cache=file_cache)
181+
```
182+
183+
You can also disable caching in similar fashion:
184+
```python
185+
adwords_client = adwords.AdWordsClient(
186+
developer_token, oauth2_client, user_agent,
187+
client_customer_id=client_customer_id, cache=suds.cache.NoCache)
188+
```
189+
165190
##Timeout Tips
166191
The requests sent by this library are sent via urllib, which is consequently
167192
where the timeout is set. If you set a system timeout elsewhere, the googleads
File renamed without changes.

examples/adwords/adwords_appengine_demo/handlers/api_handler.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import time
2020

2121

22+
from suds.cache import NoCache
23+
2224
from demo import VERSION
2325
from googleads.adwords import AdWordsClient
2426
from googleads.errors import GoogleAdsError
@@ -45,7 +47,8 @@ def __init__(self, client_id, client_secret, refresh_token,
4547
credentials = GoogleRefreshTokenClient(client_id, client_secret,
4648
refresh_token)
4749
self.client = AdWordsClient(dev_token, credentials, self._USER_AGENT,
48-
client_customer_id=manager_account_id)
50+
client_customer_id=manager_account_id,
51+
cache=NoCache)
4952

5053
def AddAdGroup(self, client_customer_id, campaign_id, name, status):
5154
"""Create a new ad group.

examples/adwords/v201605/error_handling/handle_policy_violation_error.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ def main(client, ad_group_id):
7070
operation_index = re.findall(r'operations\[(.*)\]\.',
7171
error['fieldPath'])
7272
if operation_index:
73-
operation = operations[int(operation_index[0])]
73+
index = int(operation_index[0])
74+
operation = operations[index]
7475
print ('Ad with headline \'%s\' violated %s policy \'%s\'.' %
7576
(operation['operand']['ad']['headline'],
7677
'exemptable' if error['isExemptable'] else 'non-exemptable',
@@ -85,13 +86,15 @@ def main(client, ad_group_id):
8586
operation['exemptionRequests'].append({
8687
'key': error['key']
8788
})
88-
else:
89-
# Remove non-exemptable operation
90-
print 'Removing the operation from the request.'
91-
operations.delete(operation)
89+
else:
90+
# Set non-exemptable operation to None to mark for deletion
91+
print 'Removing the operation from the request.'
92+
operations[index] = None
9293
else:
9394
# Non-policy error returned, re-throw exception.
9495
raise e
96+
# Remove the non-exemptable operations.
97+
operations = [op for op in operations if op is not None]
9598

9699
# Add these ads. Disable "validate only" so the ads will get created.
97100
client.validate_only = False

examples/adwords/v201605/reporting/download_criteria_report_as_stream_with_awql.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
"""This example downloads a criteria performance report as a string with AWQL.
17+
"""This example downloads a criteria performance report as a stream with AWQL.
1818
1919
To get report fields, run get_report_fields.py.
2020

examples/adwords/v201607/error_handling/handle_policy_violation_error.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ def main(client, ad_group_id):
7070
operation_index = re.findall(r'operations\[(.*)\]\.',
7171
error['fieldPath'])
7272
if operation_index:
73-
operation = operations[int(operation_index[0])]
73+
index = int(operation_index[0])
74+
operation = operations[index]
7475
print ('Ad with headline \'%s\' violated %s policy \'%s\'.' %
7576
(operation['operand']['ad']['headline'],
7677
'exemptable' if error['isExemptable'] else 'non-exemptable',
@@ -85,13 +86,15 @@ def main(client, ad_group_id):
8586
operation['exemptionRequests'].append({
8687
'key': error['key']
8788
})
88-
else:
89-
# Remove non-exemptable operation
90-
print 'Removing the operation from the request.'
91-
operations.delete(operation)
89+
else:
90+
# Set non-exemptable operation to None to mark for deletion
91+
print 'Removing the operation from the request.'
92+
operations[index] = None
9293
else:
9394
# Non-policy error returned, re-throw exception.
9495
raise e
96+
# Remove the non-exemptable operations.
97+
operations = [op for op in operations if op is not None]
9598

9699
# Add these ads. Disable "validate only" so the ads will get created.
97100
client.validate_only = False

examples/adwords/v201607/reporting/download_criteria_report_as_stream_with_awql.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
"""This example downloads a criteria performance report as a string with AWQL.
17+
"""This example downloads a criteria performance report as a stream with AWQL.
1818
1919
To get report fields, run get_report_fields.py.
2020

examples/adwords/v201609/error_handling/handle_policy_violation_error.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ def main(client, ad_group_id):
7070
operation_index = re.findall(r'operations\[(.*)\]\.',
7171
error['fieldPath'])
7272
if operation_index:
73-
operation = operations[int(operation_index[0])]
73+
index = int(operation_index[0])
74+
operation = operations[index]
7475
print ('Ad with headline \'%s\' violated %s policy \'%s\'.' %
7576
(operation['operand']['ad']['headline'],
7677
'exemptable' if error['isExemptable'] else 'non-exemptable',
@@ -85,13 +86,15 @@ def main(client, ad_group_id):
8586
operation['exemptionRequests'].append({
8687
'key': error['key']
8788
})
88-
else:
89-
# Remove non-exemptable operation
90-
print 'Removing the operation from the request.'
91-
operations.delete(operation)
89+
else:
90+
# Set non-exemptable operation to None to mark for deletion
91+
print 'Removing the operation from the request.'
92+
operations[index] = None
9293
else:
9394
# Non-policy error returned, re-throw exception.
9495
raise e
96+
# Remove the non-exemptable operations.
97+
operations = [op for op in operations if op is not None]
9598

9699
# Add these ads. Disable "validate only" so the ads will get created.
97100
client.validate_only = False

examples/adwords/v201609/reporting/download_criteria_report_as_stream_with_awql.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
"""This example downloads a criteria performance report as a string with AWQL.
17+
"""This example downloads a criteria performance report as a stream with AWQL.
1818
1919
To get report fields, run get_report_fields.py.
2020

0 commit comments

Comments
 (0)