The Request object has the url attribute and I could do a
request.url.startswith('https:')
or
request.url.startswith('http:')
to see if the request is an https, but I am wondering if there is a more cleaner/elegant way to do this.
I am doing this on Google App Engine.
If you’re using webapp2, you can use request.scheme.