You can conditionally set request.requires_https() depending on whether the request comes from a GAE Task Queue. Apparently, Task Queue requests will include HTTP headers as noted here:
https://stackoverflow.com/a/14838696. So, you can do something like:
if 'HTTP_X_APPENGINE_TASKNAME' not in request.env:
request.requires_https()
Note, any client can send those headers, so if you are worried about someone spoofing such a request and then getting an HTTP connection, you might instead be able to detect Task Queue requests by IP address. According to the docs,
Task Queue requests come from IP address 0.1.0.2. So, the code would be:
if request.env.remote_addr != '0.1.0.2':
request.requires_https()
Anthony