

from workout_manager import get_version

def processor(request):
    return {
        # Application version
        'version' : get_version(),
        
        # Do not track header
        'DNT': request.META['HTTP_DNT']
    }



from workout_manager import get_version

def processor(request):
    return {
        # Application version
        'version' : get_version(),
        
        # Do not track header
        'DNT': request.META.get('HTTP_DNT', False)
    }

Set a default if the browser doesn't send the DNT header
Set a default if the browser doesn't send the DNT header

  
  
  from workout_manager import get_version
  
  def processor(request):
      return {
          # Application version
          'version' : get_version(),
          
          # Do not track header
-         'DNT': request.META['HTTP_DNT']
+         'DNT': request.META.get('HTTP_DNT', False)
      }
  
Set a default if the browser doesn't send the DNT header
## Code Before:


from workout_manager import get_version

def processor(request):
    return {
        # Application version
        'version' : get_version(),
        
        # Do not track header
        'DNT': request.META['HTTP_DNT']
    }

## Instruction:
Set a default if the browser doesn't send the DNT header
## Code After:


from workout_manager import get_version

def processor(request):
    return {
        # Application version
        'version' : get_version(),
        
        # Do not track header
        'DNT': request.META.get('HTTP_DNT', False)
    }
