title: Flask Restul Basic Authentication
body: <p>I have following code for flask restful basic authentication</p>
  
  <pre><code>from flask import Flask
  from flask_restful import Resource, Api
  from flask_httpauth import HTTPBasicAuth
  
  app = Flask(__name__)
  api = Api(app, prefix="/api/v1")
  auth = HTTPBasicAuth()
  
  USER_DATA = {
      "admin": "SuperSecretPwd"
  }
  
  
  @auth.verify_password
  def verify(username, password):
      if not (username and password):
          return False
      return USER_DATA.get(username) == password
  
  
  class PrivateResource(Resource):
      @auth.login_required
      def get(self):
          return {"meaning_of_life": 42}
  
  
  api.add_resource(PrivateResource, '/private')
  
  if __name__ == '__main__':
      app.run(debug=True)
  </code></pre>
  
  <p>But if My resource class <code>PrivateResource</code> is in separate file, how can I use @auth.login_required. I don't want to import app.py in every resource file.</p>