aboutsummaryrefslogtreecommitdiffstats
path: root/access/imnc.py
diff options
context:
space:
mode:
author藍挺瑋 <lantw44@gmail.com>2012-12-21 09:52:09 +0800
committerLAN-TW <lantw44@gmail.com>2012-12-21 09:52:09 +0800
commit024f6e82e68b9e862387ec541dd4ab4328d9df9c (patch)
treefa4475e16eae807d7340d77d0cb483b6d8baaf5e /access/imnc.py
parent65b3e824ddc24ec7dc7bad883426ec88b1bcf39d (diff)
downloadinccalendar-024f6e82e68b9e862387ec541dd4ab4328d9df9c.tar.gz
inccalendar-024f6e82e68b9e862387ec541dd4ab4328d9df9c.tar.zst
inccalendar-024f6e82e68b9e862387ec541dd4ab4328d9df9c.zip
NTU CEIBA 解析支援,但網頁部份尚未實作(仍在測試中,可能修改 API)
繳交日期之後會改成字串,因為其實只有期限比較重要而已......
Diffstat (limited to 'access/imnc.py')
-rw-r--r--access/imnc.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/access/imnc.py b/access/imnc.py
new file mode 100644
index 0000000..2451bd7
--- /dev/null
+++ b/access/imnc.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+# -*- coding: UTF-8 -*-
+
+import webapp2
+from StringIO import StringIO
+
+from ntuceiba import NtuCeibaEvent
+from ntuceiba.parse import ntuceiba_parser
+from ntuceiba.toxml import ntuceiba_toxml
+
+from google.appengine.api import users
+from google.appengine.ext import db
+
+class NtuCeibaImport(webapp2.RedirectHandler):
+ def get(self):
+ return
+ def post(self):
+ viewonly = self.request.get('viewonly')
+ htmlfile = self.request.get('file')
+ if viewonly != "":
+ htmlfile = StringIO(htmlfile)
+ htmlfile.readline()
+ cblist = ntuceiba_parser(htmlfile)
+ self.response.headers['Content-Type'] = 'text/xml; charset=UTF-8'
+ self.response.out.write(ntuceiba_toxml(cblist))
+
+
+app = webapp2.WSGIApplication([('/access/imnc', NtuCeibaImport)])