@Kyle

I changed to 503  and didn't update my python.

Is this good or bad????

C:\inetpub>curl -v http://www.coolabah.com
* About to connect() to www.coolabah.com port 80 (#0)
*   Trying 205.178.189.131...
* connected
* Connected to www.coolabah.com (205.178.189.131) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.26.0
> Host: www.coolabah.com
> Accept: */*
>
< HTTP/1.1 302 Moved Temporarily
< Content-Length: 0
< Location: /?bee68f00
<
* Connection #0 to host www.coolabah.com left intact
* Closing connection #0


\inetpub>
On Friday, August 3, 2012 11:52:09 AM UTC-4, Kyle Finley wrote:
>
> @Brandon
> Yes, 503 would probably be better then 401.
>
> @Joshua
> No 429 doesn't work. I don't know if the allowed return values are 
> documented, but here's the source:
>
> http://code.google.com/p/googleappengine/source/browse/trunk/python/google/appengine/ext/webapp/_webapp25.py#345
>
>
> On Aug 3, 2012, at 10:45 AM, Joshua Smith wrote:
>
> I would have thought self.error(429). That doesn't work? Is there a doc 
> that says what codes are are allowed to return?
>
> On Aug 3, 2012, at 11:02 AM, Kyle Finley <[email protected]> wrote:
>
> Yes, thank you.  Do you have any thoughts on how to return error code 429?
>
> On Aug 3, 2012, at 9:51 AM, 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 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 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 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/-/4GmoCKWhujAJ.
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.

Reply via email to