parameters: (self, request, *args, **kwargs)
return_statement: return drf_request
docstring: Store the Django REST Framework Request object as an attribute on the
          normal Django request, store time the request started.
docstring_summary: Store the Django REST Framework Request object as an attribute on the
          normal Django request, store time the request started.
docstring_tokens: Store the Django REST Framework Request object as an attribute on the normal Django request store time the request started .
function: def initialize_request(self, request, *args, **kwargs):
          """
          Store the Django REST Framework Request object as an attribute on the
          normal Django request, store time the request started.
          """
          self.time_started = time.time()
          if getattr(settings, 'SQL_DEBUG', False):
              self.queries_before = len(connection.queries)
  
          # If there are any custom headers in REMOTE_HOST_HEADERS, make sure
          # they respect the allowed proxy list
          if all(
              [
                  settings.PROXY_IP_ALLOWED_LIST,
                  request.environ.get('REMOTE_ADDR') not in settings.PROXY_IP_ALLOWED_LIST,
                  request.environ.get('REMOTE_HOST') not in settings.PROXY_IP_ALLOWED_LIST,
              ]
          ):
              for custom_header in settings.REMOTE_HOST_HEADERS:
                  if custom_header.startswith('HTTP_'):
                      request.environ.pop(custom_header, None)
  
          drf_request = super(APIView, self).initialize_request(request, *args, **kwargs)
          request.drf_request = drf_request
          try:
              request.drf_request_user = getattr(drf_request, 'user', False)
          except AuthenticationFailed:
              request.drf_request_user = None
          except (PermissionDenied, ParseError) as exc:
              request.drf_request_user = None
              self.__init_request_error__ = exc
          except UnsupportedMediaType as exc:
              exc.detail = _(
                  'You did not use correct Content-Type in your HTTP request. ' 'If you are using our REST API, the Content-Type must be application/json'
              )
              self.__init_request_error__ = exc
          return drf_request
function_tokens: def initialize_request ( self , request , * args , * * kwargs ) : self . time_started = time . time ( ) if getattr ( settings , 'SQL_DEBUG' , False ) : self . queries_before = len ( connection . queries ) # If there are any custom headers in REMOTE_HOST_HEADERS, make sure # they respect the allowed proxy list if all ( [ settings . PROXY_IP_ALLOWED_LIST , request . environ . get ( 'REMOTE_ADDR' ) not in settings . PROXY_IP_ALLOWED_LIST , request . environ . get ( 'REMOTE_HOST' ) not in settings . PROXY_IP_ALLOWED_LIST , ] ) : for custom_header in settings . REMOTE_HOST_HEADERS : if custom_header . startswith ( 'HTTP_' ) : request . environ . pop ( custom_header , None ) drf_request = super ( APIView , self ) . initialize_request ( request , * args , * * kwargs ) request . drf_request = drf_request try : request . drf_request_user = getattr ( drf_request , 'user' , False ) except AuthenticationFailed : request . drf_request_user = None except ( PermissionDenied , ParseError ) as exc : request . drf_request_user = None self . __init_request_error__ = exc except UnsupportedMediaType as exc : exc . detail = _ ( 'You did not use correct Content-Type in your HTTP request. ' 'If you are using our REST API, the Content-Type must be application/json' ) self . __init_request_error__ = exc return drf_request