Coursera: use http.client instead, fix #163

This commit is contained in:
Mort Yao 2013-04-21 12:51:47 +02:00
parent ad1512b484
commit 1c63f70022

View File

@ -27,7 +27,11 @@ def coursera_download(url, output_dir = '.', merge = True, info_only = False):
request.install_opener(request.build_opener(request.HTTPCookieProcessor()))
response = request.urlopen(request.Request(url))
import http.client
conn = http.client.HTTPConnection('class.coursera.org')
conn.request('GET', "/%s/lecture/index" % course_code)
response = conn.getresponse()
csrf_token = r1(r'csrf_token=([^;]+);', response.headers['Set-Cookie'])
import netrc, getpass