1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#!/usr/bin/env python
# Changes required to address EULA for the origen hwpacks
import os
import sys
import argparse
import urlparse
from download_content_yes_to_lic import LicenseProtectedFileFetcher
"""Download file specified on command line"""
parser = argparse.ArgumentParser(description="Download a file, accepting "
"any licenses required to do so.")
parser.add_argument('url', metavar="URL", type=str, nargs=1,
help="URL of file to download.")
args = parser.parse_args()
fetcher = LicenseProtectedFileFetcher()
# Get file name from URL
file_name = os.path.basename(urlparse.urlparse(args.url[0]).path)
if not file_name:
print >> sys.stderr, "Could not derive file name from URL - aborting"
exit(1)
fetcher.get(args.url[0], file_name)
fetcher.close()
|