<s> """<STR_LIT>""" <EOL> from googleads import dfp <EOL> PRODUCT_TEMPLATE_ID = '<STR_LIT>' <EOL> def main ( client , product_template_id ) : <EOL> product_template_service = client . GetService ( <EOL> '<STR_LIT>' , version = '<STR_LIT>' ) <EOL> values = [ { <EOL> '<STR_LIT:key>' : '<STR_LIT:id>' , <EOL> '<STR_LIT:value>' : { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:value>' : product_template_id <EOL> } <EOL> } ] <EOL> query = '<STR_LIT>' <EOL> statement = dfp . FilterStatement ( query , values , <NUM_LIT:1> ) <EOL> response = product_template_service . getProductTemplatesByStatement ( <EOL> statement . ToStatement ( ) ) <EOL> if '<STR_LIT>' in response : <EOL> for product_template in response [ '<STR_LIT>' ] : <EOL> location = { <EOL> '<STR_LIT:id>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } <EOL> try : <EOL> targeting = product_template [ '<STR_LIT>' ] <EOL> if '<STR_LIT>' in targeting : <EOL> geo_targeting = targeting [ '<STR_LIT>' ] <EOL> if '<STR_LIT>' in geo_targeting : <EOL> geo_targeting [ '<STR_LIT>' ] . append ( location ) <EOL> else : <EOL> geo_targeting [ '<STR_LIT>' ] = [ location ] <EOL> else : <EOL> targeting [ '<STR_LIT>' ] = { <EOL> '<STR_LIT>' : [ location ] <EOL> } <EOL> except KeyError : <EOL> product_template [ '<STR_LIT>' ] = { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : [ location ] <EOL> } <EOL> } <EOL> product_templates = product_template_service . updateProductTemplates ( <EOL> [ product_template ] ) <EOL> if product_templates : <EOL> for product_template in product_templates : <EOL> print ( '<STR_LIT>' <EOL> '<STR_LIT>' % ( product_template [ '<STR_LIT:id>' ] , product_template [ '<STR_LIT:name>' ] ) ) <EOL> else : <EOL> print '<STR_LIT>' <EOL> else : <EOL> print '<STR_LIT>' <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> dfp_client = dfp . DfpClient . LoadFromStorage ( ) <EOL> main ( dfp_client , PRODUCT_TEMPLATE_ID ) </s>
