我是 Google App Engine 的新手。APScheduler 非常适合 python 中的简单代码。但是当上传到 GAE 时,它显示连续加载没有响应。
import webapp2
import sys
import time
def my_job(text):
self.response.out.write(text)
sys.path.insert(0, 'libs')
from bs4 import BeautifulSoup
from apscheduler.scheduler import Scheduler
sched = Scheduler()
class MainPage(webapp2.RequestHandler):
def get(self):
html = "<html><p>Para 1<p>Para 2<blockquote>Quote 1<blockquote>Quote 2"
soup = BeautifulSoup(html)
self.response.out.write(soup.prettify())
self.response.out.write(time.strftime("%d/%m/%Y"))
self.response.out.write(time.strftime("%H:%M:%S"))
job = sched.add_date_job(my_job, '2015-03-5 16:13:05', ['Hello World'])#
sched.start()
while True:
sleep(1)
app = webapp2.WSGIApplication([('/', MainPage)], debug=True)