diff options
| author | Tao Lin <831611+mirguest@users.noreply.github.com> | 2020-07-23 05:54:36 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-07-22 14:54:36 -0700 |
| commit | c25998bf12c5dd0e0866886fed54a95a2153e48b (patch) | |
| tree | 7924c96d6545160ae6a7312bac714c23e439a823 /wikiget/dl.py | |
| parent | 1901be9d17b1b27adc95982b84fe8aa43d3c123e (diff) | |
| download | wikiget-c25998bf12c5dd0e0866886fed54a95a2153e48b.tar.gz wikiget-c25998bf12c5dd0e0866886fed54a95a2153e48b.zip | |
Support private mediawiki (#1)
* add relative path support.
* add username and password support.
Co-authored-by: Cody Logan <clpo13@gmail.com>
Diffstat (limited to 'wikiget/dl.py')
| -rw-r--r-- | wikiget/dl.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/wikiget/dl.py b/wikiget/dl.py index 972058d..c7e593f 100644 --- a/wikiget/dl.py +++ b/wikiget/dl.py @@ -45,10 +45,10 @@ def download(dl, args): site_match = valid_site(site_name) # check for valid site parameter - if not site_match: - print('Only Wikimedia sites (wikipedia.org and wikimedia.org) ' - 'are currently supported.') - sys.exit(1) + # if not site_match: + # print('Only Wikimedia sites (wikipedia.org and wikimedia.org) ' + # 'are currently supported.') + # sys.exit(1) # check if this is a valid file if file_match and file_match.group(1): @@ -68,7 +68,10 @@ def download(dl, args): # connect to site and identify ourselves try: - site = Site(site_name, clients_useragent=USER_AGENT) + print("Site name: {}".format(site_name)) + site = Site(site_name, path=args.path, clients_useragent=USER_AGENT) + if args.username and args.password: + site.login(args.username, args.password) except ConnectionError: # usually this means there is no such site, # or there's no network connection |
