#NEWLINE# def main( client , placement_id ) : #NEWLINE# #INDENT# placement_service = client . GetService ( 'PlacementService' , version = 'v201508' ) #NEWLINE# values = [ { #NEWLINE# #INDENT# 'key' : 'placementId' , #NEWLINE# 'value' : { #NEWLINE# #INDENT# 'xsi_type' : 'NumberValue' , #NEWLINE# 'value' : placement_id , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ] #NEWLINE# query = 'WHERE id = :placementId' #NEWLINE# statement = dfp . FilterStatement ( query , values , 1 ) #NEWLINE# placements = placement_service . getPlacementsByStatement ( statement . ToStatement ( ) ) #NEWLINE# for placement in placements : #NEWLINE# #INDENT# if ( not placement [ 'targetingDescription' ] ) : #NEWLINE# #INDENT# placement [ 'targetingDescription' ] = 'Generic description' #NEWLINE# #UNINDENT# placement [ 'targetingAdLocation' ] = 'All images on sports pages.' #NEWLINE# placement [ 'targetingSiteName' ] = 'http://code.google.com' #NEWLINE# placement [ 'isAdSenseTargetingEnabled' ] = 'true' #NEWLINE# #UNINDENT# placements = placement_service . updatePlacements ( placements ) #NEWLINE# for placement in placement_id : #NEWLINE# #INDENT# print ( ( "Placement with id '%s', name '%s', and AdSense targeting enabled '%s' was updated." % ( placement [ 'id' ] , placement [ 'name' ] , placement [ 'isAdSenseTargetingEnabled' ] ) ) )