Skip to content

Instantly share code, notes, and snippets.

@mgng
Created December 19, 2012 08:31
Show Gist options
  • Select an option

  • Save mgng/4335295 to your computer and use it in GitHub Desktop.

Select an option

Save mgng/4335295 to your computer and use it in GitHub Desktop.
GAE for Python で web cron 実行させる
application: yourappname
version: 1
runtime: python
api_version: 1
threadsafe: false
handlers:
- url: /webcron
script: webcron.py
login: admin
cron:
- description: web cron sample
url: /webcron
schedule: every 1 hours
timezone: Asia/Tokyo
appcfg.py --oauth2 --noauth_local_webserver update /path/to/webcron
### webcron.py ###
# coding=utf-8
import cgi
from google.appengine.api import urlfetch
url = "http://実行させたいURL"
result = urlfetch.fetch(url)
print 'Content-Type: text/plain; charset=utf-8'
print ''
print 'webcron'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment