<s> """<STR_LIT>""" <EOL> import os <EOL> from handlers . api_handler import APIHandler <EOL> from handlers . ndb_handler import InitUser <EOL> import webapp2 <EOL> from google . appengine . api import users <EOL> from google . appengine . ext . webapp import template <EOL> class ShowAdGroups ( webapp2 . RequestHandler ) : <EOL> """<STR_LIT>""" <EOL> def get ( self ) : <EOL> """<STR_LIT>""" <EOL> client_customer_id = self . request . get ( '<STR_LIT>' ) <EOL> campaign_id = self . request . get ( '<STR_LIT>' ) <EOL> template_values = { <EOL> '<STR_LIT>' : '<STR_LIT>' % client_customer_id , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : campaign_id , <EOL> '<STR_LIT>' : client_customer_id , <EOL> '<STR_LIT>' : users . create_logout_url ( '<STR_LIT:/>' ) , <EOL> '<STR_LIT>' : users . get_current_user ( ) . nickname ( ) <EOL> } <EOL> try : <EOL> try : <EOL> app_user = InitUser ( ) <EOL> handler = APIHandler ( app_user . client_id , <EOL> app_user . client_secret , <EOL> app_user . refresh_token , <EOL> app_user . adwords_manager_cid , <EOL> app_user . developer_token ) <EOL> adgroups = handler . GetAdGroups ( client_customer_id , campaign_id ) <EOL> template_values [ '<STR_LIT>' ] = adgroups <EOL> except Exception , e : <EOL> template_values [ '<STR_LIT:error>' ] = str ( e ) <EOL> finally : <EOL> path = os . path . join ( os . path . dirname ( __file__ ) , <EOL> '<STR_LIT>' ) <EOL> self . response . out . write ( template . render ( path , template_values ) ) <EOL> def post ( self ) : <EOL> """<STR_LIT>""" <EOL> client_customer_id = self . request . get ( '<STR_LIT>' ) <EOL> campaign_id = self . request . get ( '<STR_LIT>' ) <EOL> if not client_customer_id or not campaign_id : <EOL> self . redirect ( '<STR_LIT:/>' ) <EOL> else : <EOL> self . redirect ( '<STR_LIT>' <EOL> % ( client_customer_id , campaign_id ) ) </s>
