Skip to content

Commit

Permalink
Use HTTPS for search and downloading
Browse files Browse the repository at this point in the history
  • Loading branch information
xinan committed Apr 25, 2017
1 parent b3dcc36 commit 0e0d847
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examdownloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ def getContents(self, module, username, password, destination, downloadEndCallba
updateStatus("Wrong username/password", "error")
return

conn = httplib.HTTPConnection('libbrs.nus.edu.sg:8080')
conn = httplib.HTTPSConnection('libbrs.nus.edu.sg')
page = '/infogate/jsp/#/success.jsp;jsessionid='+sessionid+'?exe=ResultList'
conn.request('GET', page, params, headersGet)
conn.close()

conn = httplib.HTTPConnection('libbrs.nus.edu.sg:8080')
conn = httplib.HTTPSConnection('libbrs.nus.edu.sg')
page = '/infogate/searchAction.do?execution=ResultList'
params = 'database=EXAM&searchstring='+module+'&d='
conn.request('POST', page, params, headers)
Expand All @@ -68,7 +68,7 @@ def getContents(self, module, username, password, destination, downloadEndCallba
return

for i in range(1, maxDocIndex+1):
conn = httplib.HTTPConnection('libbrs.nus.edu.sg:8080')
conn = httplib.HTTPSConnection('libbrs.nus.edu.sg')
page = '/infogate/searchAction.do?execution=ViewSelectedResultListLong'
params['preSelectedId'] = i
params['exportids'] = i
Expand Down Expand Up @@ -99,7 +99,7 @@ def getContents(self, module, username, password, destination, downloadEndCallba
counter += 1
updateStatus('Downloading ' + str(counter) + ' of ' + str(len(pdfs)))

conn = httplib.HTTPConnection('libbrs.nus.edu.sg:8080')
conn = httplib.HTTPSConnection('libbrs.nus.edu.sg')
conn.request('GET', page, None, headersGet)
resp = conn.getresponse()
data = resp.read()
Expand Down

0 comments on commit 0e0d847

Please # to comment.