def print_table(response, title):
 print (title + ':')
 if ('rows' not in response):
  print 'Empty response'
  return
 rows = response['rows']
 row_format = ('{:<20}' + ('{:>20}' * 4))
 print row_format.format('Keys', 'Clicks', 'Impressions', 'CTR', 'Position')
 for row in rows:
  keys = ''
  if ('keys' in row):
   keys = u','.join(row['keys']).encode('utf-8')
  print row_format.format(keys, row['clicks'], row['impressions'], row['ctr'], row['position'])

def print_table ( response , title ) : print ( title + ':' ) if ( 'rows' not in response ) : print 'Empty response' return rows = response [ 'rows' ] row_format = ( '{:<20}' + ( '{:>20}' * 4 ) ) print row_format . format ( 'Keys' , 'Clicks' , 'Impressions' , 'CTR' , 'Position' ) for row in rows : keys = '' if ( 'keys' in row ) : keys = u',' . join ( row [ 'keys' ] ) . encode ( 'utf-8' ) print row_format . format ( keys , row [ 'clicks' ] , row [ 'impressions' ] , row [ 'ctr' ] , row [ 'position' ] )
generates the sources .