From 1aa60dd2e958f91baaa3e565e36e865e74974712 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 22 Dec 2015 14:37:39 +0100 Subject: [PATCH] Fixed get_ad_unit_hierarchy.py When you store the parent ad unit on the variable "root_ad_unit" (line 55), you are actually storing an array of size 1 which contains the ad unit. That causes the code to fail at line 74 ("if root_ad_unit['id'] in ad_unit_tree:"), because "root_ad_unit" is not the object itself, is the array of size 1 containing the object. To prevent that, I've added a [0] at line 55 so you are storing the object instead an array. --- examples/dfp/v201511/inventory_service/get_ad_unit_hierarchy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/dfp/v201511/inventory_service/get_ad_unit_hierarchy.py b/examples/dfp/v201511/inventory_service/get_ad_unit_hierarchy.py index 48edc04a..af417d0d 100755 --- a/examples/dfp/v201511/inventory_service/get_ad_unit_hierarchy.py +++ b/examples/dfp/v201511/inventory_service/get_ad_unit_hierarchy.py @@ -52,7 +52,7 @@ def main(client): root_statement = dfp.FilterStatement(query) response = inventory_service.getAdUnitsByStatement( root_statement.ToStatement()) - root_ad_unit = response['results'] + root_ad_unit = response['results'][0] if root_ad_unit: BuildAndDisplayAdUnitTree(root_ad_unit, all_ad_units)