Skip to content
This repository was archived by the owner on Nov 13, 2019. It is now read-only.

Commit 2deb128

Browse files
committed
FEAT: support for python 2.7
1 parent 5f3f34d commit 2deb128

File tree

13 files changed

+72
-29
lines changed

13 files changed

+72
-29
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
.idea
2+
*.py[cod]
23
__pycache__
34
py3.6
5+
py2.7
46
target
57
client_secret.json
68
NUAAiCal.egg-info/
79
build/
810
dist/
11+
NUAAiCal-Data/

NUAAiCal/FindFirstDayofSemester.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# -*- coding: utf-8 -*-
2+
13
from lxml import etree
24
from datetime import datetime, timedelta
35
from pytz import timezone

NUAAiCal/GenerateICS.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# -*- coding: utf-8 -*-
2+
13
from icalendar import Calendar, Event, vText
24
from datetime import datetime, timedelta
35
from pytz import timezone

NUAAiCal/Lesson.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# -*- coding: utf-8 -*-
2+
13
class Lesson:
24
def __init__(self, year, semester, student_number, lesson_order_number,
35
lesson_number, name, teacher_number, teacher_name,
@@ -17,7 +19,7 @@ def __init__(self, year, semester, student_number, lesson_order_number,
1719
self.room_number = room_number
1820
self.weeks = weeks
1921

20-
def print(self):
22+
def _print(self):
2123
print('=====================================')
2224
print("学年:" + self.year)
2325
print("学期:" + self.semester)

NUAAiCal/entry.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from main import main
2+
3+
if __name__ == '__main__':
4+
main()

NUAAiCal/main.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1+
# -*- coding: utf-8 -*-
2+
3+
from __future__ import unicode_literals
4+
15
from datetime import datetime
2-
from . import settings
3-
from .FindFirstDayofSemester import get_semester_start_date
4-
from .GenerateICS import create_ics, export_ics
5-
from .Lesson import Lesson
6+
import settings
7+
from FindFirstDayofSemester import get_semester_start_date
8+
from GenerateICS import create_ics, export_ics
9+
from Lesson import Lesson
610
from lxml import etree
711
from zeep import Client
12+
from builtins import input
813

914

1015
def main():
@@ -29,7 +34,8 @@ def main():
2934
print('学期: 1 (上学期) / 2 (下学期)')
3035
print('学号: 你的南京航空航天大学学号')
3136
print("-------- 请填写以下信息 --------")
32-
xn = input('学年: ')
37+
38+
xn = input('学年: '.encode('utf-8'))
3339

3440
if '-' in xn:
3541

@@ -42,11 +48,11 @@ def main():
4248
else:
4349

4450
if not settings.DEBUG:
45-
xq = input('学期: ')
51+
xq = input('学期: '.encode('utf-8'))
4652
if not (xq == '1' or xq == '2'):
4753
print("学期输入错误! 提示:1为上学期,2为下学期!")
4854
exit()
49-
xh = input('学号: ')
55+
xh = input('学号: '.encode('utf-8'))
5056
print("==================================================")
5157

5258
semester_start_date = get_semester_start_date(years, xq, client)
@@ -55,8 +61,6 @@ def main():
5561
print("未能获得学年 " + xn + " 的校历信息")
5662
exit()
5763

58-
59-
6064
request_data = {
6165
'xn': xn,
6266
'xq': xq,
@@ -107,7 +111,7 @@ def main():
107111

108112
# Print all lessons in cli
109113
# for lesson in lessons:
110-
# lesson.print()
114+
# lesson._print()
111115

112116
cal = create_ics(lessons, semester_start_date)
113117
export_ics(cal, xn, xq, xh)

NUAAiCal/settings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
# -*- coding: utf-8 -*-
2+
13
DEBUG = False

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
# NUAA iCal Python
22

3-
![Python Version](https://img.shields.io/badge/python-3.6-blue.svg)
3+
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/NUAAiCal.svg)
44
[![pypi package](https://img.shields.io/pypi/v/NUAAiCal.svg)](https://pypi.python.org/pypi/NUAAiCal/)
55
![PyPI - Status](https://img.shields.io/pypi/status/NUAAiCal.svg)
66
![PyPI - License](https://img.shields.io/pypi/l/NUAAiCal.svg)
77

8+
:us: English | :cn: [简体中文](/README_zh-hans.md)
9+
810
Export the curriculum of NUAA to a `.ics` calendar file, in order to import
911
class events to other calendars (e.g. Google Calendar).
1012

11-
:us: English | :cn: [简体中文](/README_zh-hans.md)
12-
1313
## Installation
1414

1515
### PyPI
1616

1717
Install `NUAAiCal` python package:
1818

1919
```bash
20-
$ pip3 install NUAAiCal
20+
$ pip install NUAAiCal
2121
```
2222

2323
### Source
@@ -27,7 +27,7 @@ Built it from source code:
2727
```bash
2828
$ git clone https://github.com/Triple-Z/NUAA-iCal-Python.git
2929
$ cd NUAA-iCal-Python
30-
$ python3 setup.py install
30+
$ python setup.py install
3131
```
3232

3333
## Start Application

README_zh-hans.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
安装 `NUAAiCal` python 软件包:
1717

1818
```bash
19-
$ pip3 install NUAAiCal
19+
$ pip install NUAAiCal
2020
```
2121

2222
### 源码安装
@@ -26,7 +26,7 @@ $ pip3 install NUAAiCal
2626
```bash
2727
$ git clone https://github.com/Triple-Z/NUAA-iCal-Python.git
2828
$ cd NUAA-iCal-Python
29-
$ python3 setup.py install
29+
$ python setup.py install
3030
```
3131

3232
## 启动程序

requirement2.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
appdirs==1.4.3
2+
cached-property==1.4.0
3+
certifi==2018.1.18
4+
chardet==3.0.4
5+
defusedxml==0.5.0
6+
future==0.16.0
7+
icalendar==4.0.1
8+
idna==2.6
9+
isodate==0.6.0
10+
lxml==4.1.1
11+
NUAAiCal==0.3.6
12+
python-dateutil==2.6.1
13+
pytz==2018.3
14+
requests==2.18.4
15+
requests-toolbelt==0.8.0
16+
six==1.11.0
17+
urllib3==1.22
18+
zeep==2.5.0

0 commit comments

Comments
 (0)