john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

google app engine cron job securing a url admin

Using a regular cron job against a URL is common practice (Drupal!), though you should secure the URL...

create a cron.yaml at the root level of your project (right alongside app.yaml)

cron:

- description: daily summary job
  url: /summary/daily
  schedule: every 24 hours


# schedule: every monday 09:00
# schedule: every 5 minutes from 10:00 to 14:00
# schedule: 2nd,third mon,wed,thu of march 17:00
# schedule: 1st monday of sep,oct,nov 17:00
# schedule: every day 00:00
# schedule: every N (hours|mins|minutes) ["from" (time) "to" (time)]
# schedule:
# target: version-2   # specific version of your app!
# timezone: Australia/NSW   # if not specified, then it uses the default UTC

https://developers.google.com/appengine/docs/python/config/cron


Securing a URL via App Engine framework (app.yaml)

While any script can be run (instead of main.app) we'll stick to just protecting a part of your application...

- url: /admin-only/.*
  script: main.app
  login: admin

https://developers.google.com/appengine/docs/python/config/appconfig#Requiring_Login_or_Administrator_Status

appengine.google.com/settings
Administration -> Application Settings  (ensure that Authentication Type is Google Accounts API if you want redirect to google login)

(If set to OpenID a failed auth will return: http://MYAPP.appspot.com/_ah/login_required?continue=http://MYAPP.appspot.com/PROTECTED-URL )


  • « google app engine urlfetch xml pandora activity feed
  • Java plugin chromium browser 64 bit ubuntu »

Published

Jul 14, 2013

Category

python-appengine

~162 words

Tags

  • admin 6
  • appengine 18
  • cron 3
  • engine 12
  • google 18
  • python 180
  • securing 1
  • url 14