herr.kaste
herr.kaste

Reputation: 558

How to access the request headers when using the deferred library on GAE?

I would like to access the X-Appengine-* headers. Are these completely hidden when using the deferred library?

[Actually I'm using flask and thus werkzeug, if that matters.]

Upvotes: 1

Views: 357

Answers (2)

Guido van Rossum
Guido van Rossum

Reputation: 16890

I suspect that the OP wants to access the headers from the original request (the one that called defer()) inside the task that runs the deferred handler. Given that the deferred handler runs as a separate request, those headers are lost -- if you want them, you must grab them in the original request and pass them as arguments to the deferred function somehow.

Upvotes: 0

herr.kaste
herr.kaste

Reputation: 558

It seems that it's as simple as that:

from google.appengine.ext import webapp
req = webapp.get_request()

Upvotes: 1

Related Questions