Skip to content
This repository was archived by the owner on Apr 9, 2020. It is now read-only.

Commit cc0f15c

Browse files
takidogvn7n24fzkq
authored andcommitted
Fix webap https problem (#70)
@abc873693 Thanks for review.
1 parent 3b5e8f3 commit cc0f15c

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

src/kuas_api/kuas/ap.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#-*- encoding=utf-8 -*-
1+
# -*- encoding=utf-8 -*-
22
"""This module `ap` provide manipulate of kuas AP system.
33
"""
44

@@ -8,7 +8,7 @@
88
from lxml import etree
99
# AP URL Setting
1010
#: AP sytem base url
11-
AP_BASE_URL = "http://webap.nkust.edu.tw"
11+
AP_BASE_URL = "https://webap.nkust.edu.tw"
1212

1313
#: AP system login url
1414
AP_LOGIN_URL = AP_BASE_URL + "/nkust/perchk.jsp"
@@ -109,20 +109,20 @@ def get_semester_list():
109109
login(s, AP_GUEST_ACCOUNT, AP_GUEST_PASSWORD)
110110

111111
content = cache.ap_query(s, "ag304_01")
112-
if len(content)<3000:
112+
if len(content) < 3000:
113113
return False
114114
root = etree.HTML(content)
115115

116116
#options = root.xpath("id('yms_yms')/option")
117117
try:
118118
options = map(lambda x: {"value": x.values()[0].replace("#", ","),
119-
"selected": 1 if "selected" in x.values() else 0,
120-
"text": x.text},
121-
root.xpath("id('yms_yms')/option")
122-
)
119+
"selected": 1 if "selected" in x.values() else 0,
120+
"text": x.text},
121+
root.xpath("id('yms_yms')/option")
122+
)
123123
except:
124124
return False
125-
125+
126126
options = list(options)
127127

128128
return options
@@ -187,5 +187,5 @@ def query(session, qid, args={}):
187187

188188
if __name__ == "__main__":
189189
#import doctest
190-
#doctest.testmod()
191-
print(get_semester_list())
190+
# doctest.testmod()
191+
print(get_semester_list())

src/kuas_api/modules/stateless_auth.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def set_cookies(s, username):
5151

5252
def get_requests_session_with_cookies():
5353
s = requests.Session()
54+
s.verify = False
5455

5556
if g.username:
5657
set_cookies(s, g.username)

0 commit comments

Comments
 (0)