def custom_headers():
 headers = {}
 dnt = ('1' if config.get('network', 'do-not-track') else '0')
 headers['DNT'] = dnt
 headers['X-Do-Not-Track'] = dnt
 config_headers = config.get('network', 'custom-headers')
 if (config_headers is not None):
  for (header, value) in config_headers.items():
   headers[header.encode('ascii')] = value.encode('ascii')
 accept_language = config.get('network', 'accept-language')
 if (accept_language is not None):
  headers['Accept-Language'] = accept_language.encode('ascii')
 return sorted(headers.items())

def custom_headers ( ) : headers = { } dnt = ( '1' if config . get ( 'network' , 'do-not-track' ) else '0' ) headers [ 'DNT' ] = dnt headers [ 'X-Do-Not-Track' ] = dnt config_headers = config . get ( 'network' , 'custom-headers' ) if ( config_headers is not None ) : for ( header , value ) in config_headers . items ( ) : headers [ header . encode ( 'ascii' ) ] = value . encode ( 'ascii' ) accept_language = config . get ( 'network' , 'accept-language' ) if ( accept_language is not None ) : headers [ 'Accept-Language' ] = accept_language . encode ( 'ascii' ) return sorted ( headers . items ( ) )
set some custom headers across all http responses .