-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtasks.py
More file actions
38 lines (26 loc) · 790 Bytes
/
tasks.py
File metadata and controls
38 lines (26 loc) · 790 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import webapp2
from google.appengine.ext import db
from google.appengine.ext.webapp import util
from datetime import datetime
from models import RSSFeed, HipChatMessage
import settings
class FetchTask(webapp2.RequestHandler):
def get(self):
self.post()
def post(self):
for feed in RSSFeed.all():
feed.update()
return
class DispatchTask(webapp2.RequestHandler):
def get(self):
self.post()
def post(self):
messages = HipChatMessage.all().filter('dispatched =', None).order('-date')
for message in messages:
message.dispatch()
return
app = webapp2.WSGIApplication(
[
('/tasks/fetch' , FetchTask),
('/tasks/dispatch' , DispatchTask),
], debug=settings.DEBUG)