<s> '''<STR_LIT>''' <EOL> from string import Template <EOL> from . . oauth import OAuth2 , OAuth2Api <EOL> class Api ( OAuth2Api ) : <EOL> url = '<STR_LIT>' <EOL> headers = [ ( '<STR_LIT>' , '<STR_LIT:application/json>' ) , <EOL> ( '<STR_LIT>' , '<STR_LIT>' ) ] <EOL> def user ( self ) : <EOL> url = '<STR_LIT>' % self . url <EOL> response = self . http . get ( url , headers = self . headers ) <EOL> response . raise_for_status ( ) <EOL> return response . json ( ) <EOL> class Google ( OAuth2 ) : <EOL> auth_uri = "<STR_LIT>" <EOL> token_uri = "<STR_LIT>" <EOL> default_scope = [ '<STR_LIT>' , '<STR_LIT:email>' ] <EOL> fa = '<STR_LIT>' <EOL> def on_html_document ( self , request , doc ) : <EOL> self . google_context ( doc ) <EOL> self . add_analytics ( doc ) <EOL> key = self . config . get ( '<STR_LIT>' ) <EOL> if key : <EOL> sensor = '<STR_LIT:true>' if self . config . get ( '<STR_LIT>' ) else '<STR_LIT:false>' <EOL> doc . jscontext [ '<STR_LIT>' ] = google_map_url % ( key , sensor ) <EOL> def google_context ( self , doc ) : <EOL> google = doc . jscontext . get ( '<STR_LIT>' ) <EOL> if google is None : <EOL> doc . jscontext [ '<STR_LIT>' ] = { } <EOL> def add_analytics ( self , doc ) : <EOL> google = doc . jscontext [ '<STR_LIT>' ] <EOL> analytics = self . config . get ( '<STR_LIT>' ) <EOL> if analytics and '<STR_LIT:id>' in analytics : <EOL> google [ '<STR_LIT>' ] = analytics <EOL> if '<STR_LIT>' not in analytics : <EOL> analytics [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> txt = GOOGLE_ANALYTICS . substitute ( analytics ) <EOL> doc . head . append ( txt ) <EOL> GOOGLE_ANALYTICS = Template ( '''<STR_LIT>''' ) <EOL> google_map_url = ( '<STR_LIT>' <EOL> '<STR_LIT>' ) </s>
