2
对于我的Web应用程序,我编写了本应该访问Google App Engine数据存储区中的数据的cron作业,解析网站,然后通过电子邮件发送结果。Cron作业错误:访问数据存储并通过电子邮件发送
但是,请求cron作业时出现404
错误,并且不知道如何解决此问题。这是我访问数据库的方式吗?
感谢
这里是我的update.py
:
from google.appengine.ext import db
import urllib2
import string
import myWebapp
## CRON 1:
## Check all x in B.db if courses changed
## Yes:
## email x
## if x.things all != 'Closed':
## remove from db
boo = myWebapp.B.all()
if boo.count() >0:
for b in boo.run(batch_size=1000):
currentThings = b.mThings
newThings = myWebapp.updateStatus(b.mThings)
if currentThings != newThings:
b.mThings = newThings
myWebapp.sendTextAndEmail(b.mEmail, b.mPhoneNumMail,
b.mThings, "myWebapp Update")
numClosed = 0
for c in b.mThings:
if c[2] == 'Closed':
numClosed += 1
if numClosed == 0:
b.delete()
这里是我的cron.yaml:
cron:
- description: check things and email if change
url: /.update.py
schedule: every 5 minutes
timezone: US/Pacific
你是什么意思,使一个正常的处理程序?在update.py中声明一个RequestHandler,以及:app = webapp2.WSGIApplication('/ update.py',update)? –
是的,让一个正常的处理程序,然后去它。如果可行,请将其转换为您的cron处理程序。 –