A urllib2 handler for http and https requests that adds to a throttle.
def google.appengine.ext.remote_api.throttle.ThrottleHandler.__init__ |
( |
|
self, |
|
|
|
throttle |
|
) |
| |
Initialize a ThrottleHandler.
Args:
throttle: A Throttle instance to call for bandwidth and http/https request
throttling.
def google.appengine.ext.remote_api.throttle.ThrottleHandler.AddRequest |
( |
|
self, |
|
|
|
throttle_name, |
|
|
|
req |
|
) |
| |
Add to bandwidth throttle for given request.
Args:
throttle_name: The name of the bandwidth throttle to add to.
req: The request whose size will be added to the throttle.
def google.appengine.ext.remote_api.throttle.ThrottleHandler.AddResponse |
( |
|
self, |
|
|
|
throttle_name, |
|
|
|
res |
|
) |
| |
Add to bandwidth throttle for given response.
Args:
throttle_name: The name of the bandwidth throttle to add to.
res: The response whose size will be added to the throttle.
def google.appengine.ext.remote_api.throttle.ThrottleHandler.http_request |
( |
|
self, |
|
|
|
req |
|
) |
| |
Process an HTTP request.
If the throttle is over quota, sleep first. Then add request size to
throttle before returning it to be sent.
Args:
req: A urllib2.Request object.
Returns:
The request passed in.
def google.appengine.ext.remote_api.throttle.ThrottleHandler.http_response |
( |
|
self, |
|
|
|
unused_req, |
|
|
|
res |
|
) |
| |
Process an HTTP response.
The size of the response is added to the bandwidth throttle and the request
throttle is incremented by one.
Args:
unused_req: The urllib2 request for this response.
res: A urllib2 response object.
Returns:
The response passed in.
def google.appengine.ext.remote_api.throttle.ThrottleHandler.https_request |
( |
|
self, |
|
|
|
req |
|
) |
| |
Process an HTTPS request.
If the throttle is over quota, sleep first. Then add request size to
throttle before returning it to be sent.
Args:
req: A urllib2.Request object.
Returns:
The request passed in.
def google.appengine.ext.remote_api.throttle.ThrottleHandler.https_response |
( |
|
self, |
|
|
|
unused_req, |
|
|
|
res |
|
) |
| |
Process an HTTPS response.
The size of the response is added to the bandwidth throttle and the request
throttle is incremented by one.
Args:
unused_req: The urllib2 request for this response.
res: A urllib2 response object.
Returns:
The response passed in.
The documentation for this class was generated from the following file:
- code/googleappengine-read-only/python/google/appengine/ext/remote_api/throttle.py