Permalink
Browse files

Picks the class url from the config file.

  • Loading branch information...
abhat@J9978R1-ABHAT.corp.zynga.com abhat@J9978R1-ABHAT.corp.zynga.com
abhat@J9978R1-ABHAT.corp.zynga.com authored and abhat@J9978R1-ABHAT.corp.zynga.com committed Apr 28, 2012
1 parent 3e5df09 commit ff33019a3b89871286f5761beed924a43bb8c3a1
Showing with 10 additions and 4 deletions.
  1. +2 −2 download.cfg
  2. +8 −2 download.py
View
@@ -1,6 +1,6 @@
[credentials]
username: username
-password: password
+password: password
[download]
-url: https://class.coursera.org/algo/lecture/index
+class: https://class.coursera.org/algo/lecture/index
View
@@ -5,11 +5,17 @@ class Config(object):
SECTION_CREDENTIALS_USERNAME = 'username'
SECTION_CREDENTIALS_PASSWORD = 'password'
+ SECTION_DOWNLOAD = 'download'
+ SECTION_DOWNLOAD_CLASS = 'class'
+
+ CONFIG_FILE = 'download.cfg'
+
def __init__(self):
config = ConfigParser.ConfigParser()
- config.read('download.cfg')
+ config.read(Config.CONFIG_FILE)
self.username = config.get(Config.SECTION_CREDENTIALS, Config.SECTION_CREDENTIALS_USERNAME)
self.password = config.get(Config.SECTION_CREDENTIALS, Config.SECTION_CREDENTIALS_PASSWORD)
+ self.course = config.get(Config.SECTION_DOWNLOAD, Config.SECTION_DOWNLOAD_CLASS)
cj = cookielib.CookieJar()
@@ -69,7 +75,7 @@ def __init__(self):
r = opener.open('https://class.coursera.org/algo/auth/auth_redirector?type=login&subtype=normal&email=&visiting=%2Falgo%2Flecture%2Findex&minimal=true')
- r = opener.open('https://class.coursera.org/algo/lecture/index')
+ r = opener.open(config.course)
#print "------------3>", cj
print r.read()

0 comments on commit ff33019

Please sign in to comment.