-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
47 lines (38 loc) · 2 KB
/
main.py
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
39
40
41
42
43
44
45
46
47
# -*- coding: utf-8 -*-
import sys
from webapp2 import WSGIApplication, Route
from secrets import SESSION_KEY
# webapp2 config
app_config = {
'webapp2_extras.sessions': {
'cookie_name': '_simpleauth_sess',
'secret_key': SESSION_KEY,
},
'webapp2_extras.auth': {
'user_model': 'models.User',
'user_attributes': [],
}
}
# Map URLs to handlers
routes = [
Route('/cron/fetch_pages', handler='cron.CronHandler:fetch_pages'),
Route('/cron/send_reports', handler='cron.CronHandler:send_reports'),
Route('/worker/fetch_page_feed', handler='worker.WorkerHandler:fetch_page_feed'),
Route('/worker/fetch_page_threads', handler='worker.WorkerHandler:fetch_page_threads'),
Route('/worker/fetch_page', handler='worker.WorkerHandler:fetch_page'),
Route('/worker/fetch_pages_for_user', handler='worker.WorkerHandler:fetch_pages_for_user'),
Route('/worker/send_report', handler='worker.WorkerHandler:send_report'),
Route('/api/settings', handler='handlers.ApiHandler:post_settings', methods=['POST']),
Route('/api/user', handler='handlers.ApiHandler:get_user'),
Route('/api/pages', handler='handlers.ApiHandler:get_pages'),
Route('/api/pages/<page_id>', handler='handlers.ApiHandler:get_page', methods=['GET']),
Route('/api/pages/<page_id>/search', handler='handlers.ApiHandler:search', methods=['GET']),
Route('/api/facebook/pages/<page_id>/feed', handler='handlers.FacebookHandler:get_feed', methods=['GET']),
Route('/api/facebook/pages/<page_id>/threads', handler='handlers.FacebookHandler:get_threads', methods=['GET']),
Route('/delete', handler='handlers.AuthHandler:delete_account', methods=['POST']),
Route('/logout', handler='handlers.AuthHandler:logout', name='logout'),
Route('/auth/<provider>', handler='handlers.AuthHandler:_simple_auth', name='auth_login'),
Route('/auth/<provider>/callback', handler='handlers.AuthHandler:_auth_callback', name='auth_callback'),
Route(r'<path:.*>', handler='handlers.RootHandler'),
]
app = WSGIApplication(routes, config=app_config, debug=True)