Skip to content

Commit

Permalink
adding support for v201605 of the DFP API
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas Chen committed May 17, 2016
1 parent 23a38a3 commit 5820c98
Show file tree
Hide file tree
Showing 209 changed files with 1,245 additions and 494 deletions.
10 changes: 10 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
4.0.0 -- 5/17/2016
* Add support for DFP v201605.
* Removed examples for DFP v201505.
* Removed support for DFP v201502.
* Improved proxy support.
* BREAKING CHANGE: The googleads.common.LoadFromStorage function has been
updated to accommodate the current proxy support. This will break users with
a proxy configured. Check out the changes in our sample googleads.yaml file
to see the new format.

3.15.0 -- 4/11/2016
* Removed support for AdWords v201506.
* Resolved issues:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
def main(client, advertiser_company_id):
# Initialize appropriate service.
activity_group_service = client.GetService('ActivityGroupService',
version='v201505')
version='v201605')

# Create a short-term activity group.
short_term_activity_group = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
def main(client):
# Initialize appropriate service.
activity_group_service = client.GetService('ActivityGroupService',
version='v201505')
version='v201605')

# Create statement object to only select active activity groups.
values = [{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
def main(client):
# Initialize appropriate service.
activity_group_service = client.GetService('ActivityGroupService',
version='v201505')
version='v201605')

# Create a filter statement.
statement = dfp.FilterStatement()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
def main(client, activity_group_id, advertiser_company_id):
# Initialize appropriate service.
activity_group_service = client.GetService('ActivityGroupService',
version='v201505')
version='v201605')

# Create statement object to select a single activity groups by ID.
values = [{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

def main(client, activity_group_id):
# Initialize appropriate service.
activity_service = client.GetService('ActivityService', version='v201505')
activity_service = client.GetService('ActivityService', version='v201605')

# Create a daily visits activity.
daily_visits_activity = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

def main(client):
# Initialize appropriate service.
activity_service = client.GetService('ActivityService', version='v201505')
activity_service = client.GetService('ActivityService', version='v201605')

# Create statement object to only select active activities.
values = [{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

def main(client):
# Initialize appropriate service.
activity_service = client.GetService('ActivityService', version='v201505')
activity_service = client.GetService('ActivityService', version='v201605')

# Create statement object to select only all activities.
statement = dfp.FilterStatement()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

def main(client, activity_id):
# Initialize appropriate service.
activity_service = client.GetService('ActivityService', version='v201505')
activity_service = client.GetService('ActivityService', version='v201605')

# Create statement object to select one activity by ID to update.
values = [{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ def main(client, custom_targeting_key_id, custom_targeting_value_id):

# Initialize appropriate services.
audience_segment_service = client.GetService(
'AudienceSegmentService', version='v201505')
network_service = client.GetService('NetworkService', version='v201505')
'AudienceSegmentService', version='v201605')
network_service = client.GetService('NetworkService', version='v201605')

# Get the root ad unit ID used to target the entire network.
root_ad_unit_id = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def main(client):

# Initialize appropriate service.
audience_segment_service = client.GetService(
'AudienceSegmentService', version='v201505')
'AudienceSegmentService', version='v201605')

# Create statement object to select all audience segments.
statement = dfp.FilterStatement()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def main(client):

# Initialize appropriate service.
audience_segment_service = client.GetService(
'AudienceSegmentService', version='v201505')
'AudienceSegmentService', version='v201605')

# Create statement object to only select first party audience segments.
values = [{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def main(client, audience_segment_id):

# Initialize appropriate service.
audience_segment_service = client.GetService(
'AudienceSegmentService', version='v201505')
'AudienceSegmentService', version='v201605')

# Create statement object to get the specified first party audience segment.
values = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def main(client, audience_segment_id):

# Initialize appropriate service.
audience_segment_service = client.GetService(
'AudienceSegmentService', version='v201505')
'AudienceSegmentService', version='v201605')

# Create statement object to get the specified first party audience segment.
values = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
def main(client, product_id, rate_card_id):
# Initialize appropriate service.
base_rate_service = client.GetService(
'BaseRateService', version='v201505')
'BaseRateService', version='v201605')

# Create a product base rate.
product_base_rate = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
def main(client, product_template_id, rate_card_id):
# Initialize appropriate service.
base_rate_service = client.GetService(
'BaseRateService', version='v201505')
'BaseRateService', version='v201605')

# Create a product template base rate.
product_template_base_rate = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

def main(client):
# Initialize appropriate service.
base_rate_service = client.GetService('BaseRateService', version='v201505')
base_rate_service = client.GetService('BaseRateService', version='v201605')

# Create a filter statement.
statement = dfp.FilterStatement('ORDER BY id ASC')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

def main(client, rate_card_id):
# Initialize appropriate service.
base_rate_service = client.GetService('BaseRateService', version='v201505')
base_rate_service = client.GetService('BaseRateService', version='v201605')

# Create a filter statement for base rates for a single rate card.
values = [{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

def main(client, base_rate_id):
# Initialize appropriate service.
base_rate_service = client.GetService('BaseRateService', version='v201505')
base_rate_service = client.GetService('BaseRateService', version='v201605')

# Create a filter statement for base rates for a single rate card.
values = [{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

def main(client):
# Initialize appropriate service.
company_service = client.GetService('CompanyService', version='v201505')
company_service = client.GetService('CompanyService', version='v201605')

# Create company objects.
companies = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

def main(client):
# Initialize appropriate service.
company_service = client.GetService('CompanyService', version='v201505')
company_service = client.GetService('CompanyService', version='v201605')

# Create statement object to only select companies that are advertisers.
values = [{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

def main(client):
# Initialize appropriate service.
company_service = client.GetService('CompanyService', version='v201505')
company_service = client.GetService('CompanyService', version='v201605')

# Create statement object to select all companies.
statement = dfp.FilterStatement()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

def main(client, company_id):
# Initialize appropriate service.
company_service = client.GetService('CompanyService', version='v201505')
company_service = client.GetService('CompanyService', version='v201605')

# Create statement object to only select a single company by ID.
values = [{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

def main(client, advertiser_company_id, agency_company_id):
# Initialize appropriate service.
contact_service = client.GetService('ContactService', version='v201505')
contact_service = client.GetService('ContactService', version='v201605')

# Create an advertiser contact.
advertiser_contact = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

def main(client):
# Initialize appropriate service.
contact_service = client.GetService('ContactService', version='v201505')
contact_service = client.GetService('ContactService', version='v201605')

# Create statement object to get all contacts.
statement = dfp.FilterStatement()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

def main(client):
# Initialize appropriate service.
contact_service = client.GetService('ContactService', version='v201505')
contact_service = client.GetService('ContactService', version='v201605')

# Create statement object to only select contacts that are uninvited.
values = [{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

def main(client, contact_id):
# Initialize appropriate service.
contact_service = client.GetService('ContactService', version='v201505')
contact_service = client.GetService('ContactService', version='v201605')

# Create statement object to select the single contact by ID.
values = [{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
def main(client, hierarchy_level_one_key_id, hierarchy_level_two_key_id):
# Initialize appropriate service.
content_metadata_key_hierarchy_service = client.GetService(
'ContentMetadataKeyHierarchyService', version='v201505')
'ContentMetadataKeyHierarchyService', version='v201605')

hierarchy_level_1 = {
'customTargetingKeyId': hierarchy_level_one_key_id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
def main(client, content_metadata_key_hierarchy_id):
# Initialize appropriate service.
content_metadata_key_hierarchy_service = client.GetService(
'ContentMetadataKeyHierarchyService', version='v201505')
'ContentMetadataKeyHierarchyService', version='v201605')

# Create a query to select a single content metadata key hierarchy.
values = [{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
def main(client):
# Initialize appropriate service.
content_metadata_key_hierarchy_service = client.GetService(
'ContentMetadataKeyHierarchyService', version='v201505')
'ContentMetadataKeyHierarchyService', version='v201605')

# Create statement object to select all content.
statement = dfp.FilterStatement()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
def main(client, content_metadata_key_hierarchy_id, custom_targeting_key_id):
# Initialize appropriate service.
content_metadata_key_hierarchy_service = client.GetService(
'ContentMetadataKeyHierarchyService', version='v201505')
'ContentMetadataKeyHierarchyService', version='v201605')

# Create a query to select a single content metadata key hierarchy.
values = [{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

def main(client):
# Initialize appropriate service.
content_service = client.GetService('ContentService', version='v201505')
content_service = client.GetService('ContentService', version='v201605')

# Create statement object to select all content.
statement = dfp.FilterStatement()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@

def main(client):
# Initialize appropriate service.
content_service = client.GetService('ContentService', version='v201505')
network_service = client.GetService('NetworkService', version='v201505')
content_service = client.GetService('ContentService', version='v201605')
network_service = client.GetService('NetworkService', version='v201605')
custom_targeting_service = client.GetService(
'CustomTargetingService', version='v201505')
'CustomTargetingService', version='v201605')

# Get the network's content browse custom targeting key.
network = network_service.getCurrentNetwork()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

def main(client, advertiser_id):
# Initialize appropriate service.
creative_service = client.GetService('CreativeService', version='v201505')
creative_service = client.GetService('CreativeService', version='v201605')

# Use the image banner with optional third party tracking template.
creative_template_id = '10000680'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

def main(client, advertiser_id):
# Initialize appropriate service.
creative_service = client.GetService('CreativeService', version='v201505')
creative_service = client.GetService('CreativeService', version='v201605')

# Create creative objects.
creatives = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

def main(client, advertiser_id):
# Initialize appropriate service.
creative_service = client.GetService('CreativeService', version='v201505')
creative_service = client.GetService('CreativeService', version='v201605')

# Get the image data for the creative.
image_data = open(os.path.join(os.path.split(__file__)[0], '..', '..', 'data',
Expand All @@ -64,8 +64,10 @@ def main(client, advertiser_id):
{
'xsi_type': 'CustomCreativeAsset',
'macroName': 'IMAGE_ASSET',
'assetByteArray': image_data,
'fileName': 'image%s.jpg' % uuid.uuid4()
'asset': {
'assetByteArray': image_data,
'fileName': 'image%s.jpg' % uuid.uuid4()
}
}
],
'htmlSnippet': html_snippet
Expand Down

0 comments on commit 5820c98

Please sign in to comment.