I'm coming across a rather strange problem in a small app I've made for Google App Engine. This is not intended to be accessed by a browser but to provide a kind of rudimentary REST API for another system. This is the basic structure of the app:
import webapp2
class MainPage(webapp2.RequestHandler):
def post(self):
<do good stuff>
def get(self):
raise Exception("Cannot call this app through a get request")
app = webapp2.WSGIApplication([('/objviewer/', MainPage)],debug=True)
It works fine with this in my app.yaml:
- url: /objviewer/
script: gaeobjviewer.app
and with this code from a python script to call it:
encodedurl = urllib.urlencode({'tablename':tablename,'objid':objid})
# uploadservers[uploadkey] in the next line is a URL
response = urllib2.urlopen(uploadservers[uploadkey], data = encodedurl)
print response.read()
Now, in my app.yaml, suppose I add in a "secure: always" line:
- url: /objviewer/
secure: always
script: gaeobjviewer.app
The script promptly fails and claims it's being called with a get request. self.request.GET reports an empty dictionary.
Changing the protocol from http to https or vice versa in the urllib2.urlopen call makes no difference.
In the available literature on https I can find nothing about an empty GET request. Nor is there any reference to this in the GAE documentation that I can find. Why might this be occurring?