title: Python Flask: What is requesting a page to trigger a 404 error several times a second?
body: <p>This is sitting on an internal development server with no access from the outside world</p>
  <p>In my logs I have</p>
  <pre><code>2022-06-20 11:25:21,376 - ERROR - __init__.py - handle_error_404 - 64 - 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
  2022-06-20 11:25:21,392 - ERROR - __init__.py - handle_error_404 - 64 - 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
  2022-06-20 11:25:21,548 - ERROR - __init__.py - handle_error_404 - 64 - 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
  2022-06-20 11:25:21,673 - ERROR - __init__.py - handle_error_404 - 64 - 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
  2022-06-20 11:25:21,736 - ERROR - __init__.py - handle_error_404 - 64 - 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
  2022-06-20 11:25:21,751 - ERROR - __init__.py - handle_error_404 - 64 - 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
  2022-06-20 11:25:21,830 - ERROR - __init__.py - handle_error_404 - 64 - 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
  2022-06-20 11:25:21,892 - ERROR - __init__.py - handle_error_404 - 64 - 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
  </code></pre>
  <p>This is in a Python Flask installation on IIS. The error handling is done thus:</p>
  <pre><code>handler = RotatingFileHandler(os.path.join(app.root_path, 'logs', 'error_log.log'), maxBytes=102400, backupCount=10)
  logging_format = logging.Formatter(
          '%(asctime)s - %(levelname)s - %(filename)s - %(funcName)s - %(lineno)s - %(message)s')
      
  handler.setFormatter(logging_format)
  app.logger.addHandler(handler)
      
  def handle_error_404(error):
      &quot;&quot;&quot;
      404
      &quot;&quot;&quot;
      app.logger.error(error)
      flash(f'Server says: {error}', 'error')
      return render_template('404.jinja2', layout = 'container')
      
  def handle_error_400(error):
      &quot;&quot;&quot;
      400
      &quot;&quot;&quot;
      app.logger.error(error)
      flash(f'Server says: {error}', 'error')
      return render_template('400.jinja2', layout = 'container')
      
  def handle_error_500(error):
      &quot;&quot;&quot;
      500
      &quot;&quot;&quot;
      app.logger.error(error)
      flash(f'Server says: {error}', 'error')
      return render_template('500.jinja2', selected_menu_item=None)
      
  app.errorhandler(400)(handle_error_400)
  app.errorhandler(404)(handle_error_404)
  app.errorhandler(500)(handle_error_500) 
  </code></pre>
  <p>How do I find out what's calling the page and what page is it calling?</p>
  <p>Thanks</p>
  <p><strong>UPDATE</strong></p>
  <p>I added the below</p>
  <pre><code>@app.before_request
      def before():
          app.logger.debug(request.url)
          app.logger.debug(request.remote_addr)
  </code></pre>
  <p>I now get the following:</p>
  <pre><code>/Discovery/HTTPsvc/IISXferWanServer.DLL
  </code></pre>