Skip to content

Commit

Permalink
Merge pull request #10 from Yohanna/master
Browse files Browse the repository at this point in the history
Improved Python 3 compatibility.
  • Loading branch information
gaganpreet committed Sep 14, 2014
2 parents aa7a3a8 + cc2b2e5 commit 348d238
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions udemy-dl.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
import os
import json
from bs4 import BeautifulSoup

try:
from urllib import urlretrieve
except:
from urllib.request import urlretrieve
from urllib import urlretrieve # Python 2
except ImportError:
from urllib.request import urlretrieve # Python 3


class Session:
Expand Down Expand Up @@ -159,12 +160,16 @@ def main():
link = args['link']

if not username:
print('Username/Email:'),
username = raw_input()
try:
username = raw_input("Username/Email: ") # Python 2
except NameError:
username = input("Username/Email: ") # Python 3

if not password:
password = getpass.getpass(prompt='Password: ')

udemy_dl(username, password, link)


if __name__ == '__main__':
main()

0 comments on commit 348d238

Please sign in to comment.