Hi David, You didn't actually say in your message what the problem you're encountering is. However, one issue with your cron script is that you're attempting to get the current user in it. Although the cron system can access 'login' and 'admin' URLs, it does not have a user account, so get_current_user will always return None.
-Nick Johnson On Thu, Oct 1, 2009 at 10:24 PM, David <[email protected]> wrote: > > Hi > > I'm obviously a novice to the app engine, I have been tinkering with > it off and on for a bit. I've spent a stupid amount of time today > trying to figure out why this doesnt work. > > I have a cron job to perform a cron every 5 minutes (I will include > everything below) at first I thought it must be my code - but then I > tried using some code from the google pages - > > Any clues? I'm finding it really hard to debug - I can't see how I get > a message that says where its blown up, am I being stupid? > > grabber.py > ^^^^^^^^^^^^ > > from google.appengine.api import users > from google.appengine.ext import webapp > from google.appengine.ext.webapp.util import run_wsgi_app > > class grabber(webapp.RequestHandler): > def get(self): > user = users.get_current_user() > > if user: > self.response.headers['Content-Type'] = 'text/plain' > self.response.out.write('Hello, ' + user.nickname()) > else: > self.redirect(users.create_login_url(self.request.uri)) > > application = webapp.WSGIApplication( > [('/', 'grabber')], > debug=True) > > def main(): > run_wsgi_app(application) > > if __name__ == "__main__": > main() > > > cron.yaml > ************ > > cron: > - description: grabs some data > url: /grabber > schedule: every 1 minutes > > > app.yaml > *********** > > application: ##My application name usually here > version: 1 > runtime: python > api_version: 1 > > handlers: > - url: /grabber > script: grabber.py > > - url: / > script: main.py > > - url: /favicon.ico > static_files: favicon.ico > upload: favicon.ico > > > > > -- Nick Johnson, Developer Programs Engineer, App Engine Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number: 368047 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
