|
40 | 40 |
|
41 | 41 | def download_sql_backup(url, user, password, dry_run=False, overwrite_existing=False, prepend_date=True, basename=None,
|
42 | 42 | output_directory=os.getcwd(), exclude_dbs=None, compression='none', prefix_format=None,
|
43 |
| - timeout=60, **kwargs): |
| 43 | + timeout=60, http_auth=None, **kwargs): |
44 | 44 | prefix_format = prefix_format or DEFAULT_PREFIX_FORMAT
|
45 | 45 | exclude_dbs = exclude_dbs.split(',') or []
|
46 | 46 | encoding = '' if compression == 'gzip' else 'gzip'
|
47 | 47 |
|
48 | 48 | g = grab.Grab(encoding=encoding, timeout=timeout)
|
| 49 | + if http_auth: |
| 50 | + g.setup(userpwd=http_auth) |
49 | 51 | g.go(url)
|
50 | 52 |
|
51 | 53 | g.doc.set_input_by_id('input_username', user)
|
@@ -125,6 +127,8 @@ def download_sql_backup(url, user, password, dry_run=False, overwrite_existing=F
|
125 | 127 | 'Must be used with --prepend-date to be in effect'.format(DEFAULT_PREFIX_FORMAT.replace('%', '%%'))))
|
126 | 128 | parser.add_argument('--dry-run', action='store_true', default=False,
|
127 | 129 | help='dry run, do not actually download any file')
|
| 130 | + parser.add_argument('--http-auth', default=None, |
| 131 | + help='Basic http authentication, using format "username:password"') |
128 | 132 |
|
129 | 133 | args = parser.parse_args()
|
130 | 134 |
|
|
0 commit comments