Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c04c96b

Browse files
Add an option to manage basic http authentication.
1 parent f08b713 commit c04c96b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

‎README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ _Note_: The web interface of phpMyAdmin may change in the future and break this
5454
format. Must be used with --prepend-date to be in
5555
effect
5656
--dry-run dry run, do not actually download any file
57+
--http-auth Basic http authentication, using format
58+
"username:password"
5759

5860
Written by Christoph Haunschmidt, version: 2016年03月12日.3
5961

‎phpmyadmin_sql_backup.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,14 @@
4040

4141
def download_sql_backup(url, user, password, dry_run=False, overwrite_existing=False, prepend_date=True, basename=None,
4242
output_directory=os.getcwd(), exclude_dbs=None, compression='none', prefix_format=None,
43-
timeout=60, **kwargs):
43+
timeout=60, http_auth=None, **kwargs):
4444
prefix_format = prefix_format or DEFAULT_PREFIX_FORMAT
4545
exclude_dbs = exclude_dbs.split(',') or []
4646
encoding = '' if compression == 'gzip' else 'gzip'
4747

4848
g = grab.Grab(encoding=encoding, timeout=timeout)
49+
if http_auth:
50+
g.setup(userpwd=http_auth)
4951
g.go(url)
5052

5153
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
125127
'Must be used with --prepend-date to be in effect'.format(DEFAULT_PREFIX_FORMAT.replace('%', '%%'))))
126128
parser.add_argument('--dry-run', action='store_true', default=False,
127129
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"')
128132

129133
args = parser.parse_args()
130134

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /