Just read this. Thanks.
Looks like it works now.
Thanks to all!!!!!
Kate
On Friday, August 3, 2012 10:51:23 AM UTC-4, Joshua Smith wrote:
>
> There are couple problems with your snippet.
>
> First, she's getting HEAD not GET requests, so you need to use different
> handler.
>
> Also, you aren't returning, so if you were in a GET request, it would
> proceed to handle the request regardless.
>
> Something more like this (untested):
>
> class MainHandler(webapp.RequestHandler):
> def head(self):
> self.error(401)
>
> def get(self):
> if (self.request.headers['User-Agent'].startswith('curl'))
> self.error(401)
> return
> # rest of the get handler
>
> On Aug 3, 2012, at 10:34 AM, Kyle Finley <[email protected]> wrote:
>
> Hi Joshua,
>
> Thank you, that's a good thought.
>
> Kate sent me some files offline, and I believe we've figured out the
> problem. For the middleware to work you must be using WSGI not CGI. Someone
> please correct me if I'm wrong, but I believe she would have to upgrade
> here App to python27 to use it. The alternative is to do the check in the
> webapp request handler:
>
> def check_for_curl(self):
> if self.request.environ['HTTP_USER_AGENT'].startswith('curl'):
> return self.error(401)
>
> class MainHandler(webapp.RequestHandler):
> def get(self):
> check_for_curl(self)
> # handle request
>
> The problem is that webapp doesn't recognize error code 429 so we have to
> use something else. Unless there's a simple way to make it write 429?
>
> - Kyle
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-appengine/-/TQuZYYR0wrAJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-appengine/-/hI3PU4EwpG0J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.