#8 new
Aaron Zinman

Interact with quota

Reported by Aaron Zinman | March 24th, 2010 @ 01:15 AM | in First beta test

Catch OverQuotaError's in Django's main loop/entry from request:

The following example illustrates how to catch the OverQuotaError, which may be raised by the SendMessage() method if an email-related quota has been exceeded:
try:
mail.SendMessage(to='test@example.com',

               from='admin@example.com',
               subject='Test Email',
               body='Testing')

except apiproxy_errors.OverQuotaError, message:
# Log the error. logging.error(message) # Display an informative message to the user. self.response.out.write('The email could not be sent. '

                      'Please try again later.')

Also, debug cpu load using the following sample:

import logging
from google.appengine.api import quota

start = quota.get_request_cpu_usage()
do_something_expensive()
end = quota.get_request_cpu_usage()

logging.info("do_something_expensive() cost %d megacycles." % (start - end))

No comments found

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

website front-end for skill entry, translation, and search

Shared Ticket Bins

People watching this ticket

Tags

Pages