From 716d1cc3e8283fe5a0f0a95b08fbe648e625bc33 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Sat, 17 Sep 2022 12:56:13 -0700 Subject: [PATCH 1/2] Fix logerror for "XML export on this wiki is broken, quitting." --- dumpgenerator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dumpgenerator.py b/dumpgenerator.py index c5d109c2..38830c5f 100755 --- a/dumpgenerator.py +++ b/dumpgenerator.py @@ -492,7 +492,7 @@ def getXMLHeader(config={}, session=None): header, config = getXMLHeader(config=config, session=session) else: print 'XML export on this wiki is broken, quitting.' - logerror(u'XML export on this wiki is broken, quitting.') + logerror(config=config, text=u'XML export on this wiki is broken, quitting.') sys.exit() return header, config From 0008808f53d083b7cb939ad2c1d29f48d9162f14 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Sat, 17 Sep 2022 12:56:25 -0700 Subject: [PATCH 2/2] Add --insecure option --- dumpgenerator.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/dumpgenerator.py b/dumpgenerator.py index 38830c5f..c40632d3 100755 --- a/dumpgenerator.py +++ b/dumpgenerator.py @@ -1684,6 +1684,9 @@ def getParameters(params=[]): '--pass', dest='password', help='Password if authentication is required.') + parser.add_argument('--insecure', + action='store_true', + help='Ignore SSL certificate errors.') # URL params groupWikiOrAPIOrIndex = parser.add_argument_group() @@ -1738,6 +1741,14 @@ def getParameters(params=[]): args = parser.parse_args() # print args + if args.insecure: + # https://stackoverflow.com/a/66207445 + import ssl + ssl._create_default_https_context = ssl._create_unverified_context + ssl.SSLContext.verify_mode = property(lambda self: ssl.CERT_NONE, lambda self, newval: None) + requests.packages.urllib3.disable_warnings(category=requests.packages.urllib3.exceptions.InsecureRequestWarning) + print("WARNING: HTTPS certificate verification is disabled.") + # Don't mix download params and meta info params if (args.xml or args.images) and \ (args.get_wiki_engine): @@ -1925,7 +1936,8 @@ def getParameters(params=[]): 'resume': args.resume, 'filenamelimit': 100, # do not change 'force': args.force, - 'session': session + 'session': session, + 'insecure': args.insecure } # calculating path, if not defined by user with --path= @@ -2553,6 +2565,9 @@ def main(params=[]): os.mkdir(config['path']) saveConfig(config=config, configfilename=configfilename) + if other['insecure']: + logerror(config=config, text=u'WARNING: HTTPS certificate verification is disabled.') + if other['resume']: resumePreviousDump(config=config, other=other) else: