title: 405 Method Not Allowed The method GET is not allowed for this resource (AppEngine, Python)
body: <p>NOTE: I think I have found what's wrong in my code, I had not installed the request module. I'm investigating this now.</p>
  
  <p>I'm banging my head against the wall with this appengine application. Tried the remedies given for similar questions to no avail. Maybe someone can spot what the issue is?</p>
  
  <p>Here's what I'm doing:</p>
  
  <p>1) I create a product in the app based on the user's input. Once written to the ndb I call a page to display the recently created product:</p>
  
  <pre><code>import requests
  ....
  r = requests.post('products_display', data = {'find_id_txt':prod_id_txt})
  </code></pre>
  
  <p>The request is routed through:</p>
  
  <pre><code>application = webapp2.WSGIApplication([
      ('/products_add', AddProduct),      
      ('/products_display', DisplayProduct),    
      ...
  ], config = session_params, debug = True) 
  </code></pre>
  
  <p>It then arrives at the correct handler and I get the 405 error (405 Method Not Allowed The method GET is not allowed for this resource). The browser shows this url:</p>
  
  <pre><code>http://localhost:8080/products_display
  </code></pre>
  
  <p>This is the code of the handler (for the moment I just display a page to tell if the product was found or not).</p>
  
  <pre><code>class DisplayProduct(BaseHandler):
      # Finds a product on exact Prod_ID property
      def get(self):
          user = usermgmt.get_user(self)
          logout_url = users.create_logout_url(self.request.uri)
          access = usermgmt.get_auth("Products")  
          client_name = usermgmt.get_client_subdomain()
          search_key = self.request.get('find_id_txt')
          find_query = models.Product.query(models.Product.prod_id == search_key, ancestor = get_products_key()).get()
          # Check if query returned a value
          if find_query:      
              template_values = {
                  'client_name': client_name,              
                  'user': user,
                  'logout_url': logout_url,
                  'alert_message': "Product1: " + search_key + " was found."
              }
              template = JINJA_ENVIRONMENT.get_template('alert-blue.html')
              self.response.write(template.render(template_values))               
          else:
              template_values = {
                  'client_name': client_name,              
                  'user': user,
                  'logout_url': logout_url,
                  'alert_message': "Product1: " + search_key + " could not be found."
              }
              template = JINJA_ENVIRONMENT.get_template('alert-yellow.html')
              self.response.write(template.render(template_values))            
  </code></pre>
  
  <p>I tried all possible combinations of sending a get, then a post request and changing get for post on the handler. Each time I logged out of the browser or use another one and still I get the error.</p>
  
  <p>Here's the content of my app.yaml file:</p>
  
  <pre><code>#application: fpp-system
  #version: 1
  runtime: python27
  api_version: 1
  threadsafe: true
  
  handlers:
  
  - url: /categories.*
    script: categories.application
    login: required
  
  - url: /calendar.*
    script: calendars.application
    login: required
  
  - url: /images
    static_dir: images
  
  - url: /products.*
    script: products.application
    login: required
  
  - url: /signin.*
    script: signin.application
  
  - url: /stylesheets
    static_dir: stylesheets
  
  - url: /test.*
    script: test.application
  
  - url: /units.*
    script: units.application
    login: required 
  
  - url: /.*
    script: main.application
  
  libraries:
  - name: webapp2
    version: latest
  - name: jinja2
    version: latest
  </code></pre>
  
  <p>The code is written using pydev on eclipse neon on Linux Ubuntu 16.04. Once it's debugged I can upload it to Google's cloud.</p>
  
  <p>Thanks in advance for any tips!</p>
  
  <p>ADDED AFTER 1ST COMMENTS:</p>
  
  <p>a) Copied indentation correctly: def get(self) and following are now indented correctly.</p>
  
  <p>b) Added contents of app.yaml</p>
  
  <p>c) The get function works well when I call it from an html page to find a product, here's the code snippet with the form to ask for required info:</p>
  
  <pre><code> &lt;form action="/products_display" method="post"&gt;
     &lt;div&gt;&lt;input value="" name="find_id_txt" size="15"&gt;&lt;/div&gt;
     &lt;div&gt;&lt;input type="submit" value="Find"&gt;&lt;/div&gt;
   &lt;/form&gt;&lt;br&gt;
  </code></pre>
  
  <p>but it gives the 405 error when I call it programmatically with:</p>
  
  <pre><code>r = requests.post('products_display', data = {'find_id_txt':prod_id_txt})
  </code></pre>