mirror of
https://github.com/coursera-dl/coursera-dl.git
synced 2026-01-23 02:35:37 +00:00
Merge pull request #724 from vstrizhenok/master
added ca param on command line - good solution for #702
This commit is contained in:
commit
fa8f4d810f
3 changed files with 15 additions and 2 deletions
|
|
@ -280,6 +280,8 @@ class names, as well as any additional parameters:
|
|||
|
||||
General: coursera-dl -u <user> -p <pass> modelthinking-004
|
||||
|
||||
With CAUTH parameter: coursera-dl -ca 'some-ca-value-from-browser' modelthinking-004
|
||||
|
||||
If you don't want to type your password in command line as plain text, you can use the script without `-p` option. In this case you will be prompted for password once the script is run.
|
||||
|
||||
Without -p field: coursera-dl -u <user> modelthinking-004
|
||||
|
|
|
|||
|
|
@ -341,6 +341,14 @@ def parse_args(args=None):
|
|||
group_adv_auth = parser.add_argument_group(
|
||||
'Advanced authentication options')
|
||||
|
||||
group_adv_auth.add_argument(
|
||||
'-ca',
|
||||
'--cauth',
|
||||
dest='cookies_cauth',
|
||||
action='store',
|
||||
default=None,
|
||||
help='cauth cookie value from browser')
|
||||
|
||||
group_adv_auth.add_argument(
|
||||
'-c',
|
||||
'--cookies_file',
|
||||
|
|
@ -492,7 +500,7 @@ def parse_args(args=None):
|
|||
logging.error('Cookies file not found: %s', args.cookies_file)
|
||||
sys.exit(1)
|
||||
|
||||
if not args.cookies_file:
|
||||
if not args.cookies_file and not args.cookies_cauth:
|
||||
try:
|
||||
args.username, args.password = get_credentials(
|
||||
username=args.username, password=args.password,
|
||||
|
|
|
|||
|
|
@ -233,7 +233,10 @@ def main():
|
|||
return
|
||||
|
||||
session = get_session()
|
||||
login(session, args.username, args.password)
|
||||
if args.cookies_cauth:
|
||||
session.cookies.set('CAUTH', args.cookies_cauth)
|
||||
else:
|
||||
login(session, args.username, args.password)
|
||||
if args.specialization:
|
||||
args.class_names = expand_specializations(session, args.class_names)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue