title: How to debug a flask-restful api with pdb
body: <p>I want to use pdb to step into some flask-restful code. I have an endpoint which returns a token. I then use the token to access another endpoint which returns the required data. I would like to view the result of a database query. How do I go about this?</p>
  
  <p>I tried setting a breakpoint inside the class, but it does not get triggered when I send a request using the request library. </p>
  
  <pre><code>class FetchData(Resource):
  
      @jwt_required
      def get(self, args):
  
          engine = create_engine('mysql+pymysql://')
          conn = engine.connect()
  
          tablemeta = MetaData()
          tablemeta.reflect(bind=engine)
  
          keydate = tablemeta.tables['KEYDATE']
          coefficient = tablemeta.tables['COEFFICIENT']
          vessel = tablemeta.tables['VESSEL']
          update_dict = {}
  
  
          s = select([coefficient])
          s = s.where(coefficient.c.updated_date &gt;= args["dt"])
          rp = conn.execute(s)
  
          result = []
  
          for r in rp:
              j = coefficient.join(vessel, r['idvessel'] == vessel.c.idvessel)
  
              import pdb
              pdb.set_trace()
              vdm_id = select([vessel.c.vessel_id]).select_from(j)
              vdm_id = conn.execute(vdm_id).scalar()
  
              intermediate = []
              intermediate.append({"vdm_id": vdm_id})
              intermediate.append([dict(r)])
  
              result.append(intermediate)
  </code></pre>
  
  <p>Or possibly there's another debugger I should be using?</p>