jenkins-bot has submitted this change and it was merged.
Change subject: Don't use SSL if not available ......................................................................
Don't use SSL if not available
There might still be some installations with httplib without HTTPS for some reason.
Don't try to use https on those (in case of Wikipedia, the use of SSL was actually forced).
Change-Id: I5809364eb02d8669fc2b62734ca1e3e48824b129 --- M family.py 1 file changed, 13 insertions(+), 2 deletions(-)
Approvals: Merlijn van Deen: Looks good to me, approved jenkins-bot: Verified
diff --git a/family.py b/family.py index 30e2bed..30d2dbc 100644 --- a/family.py +++ b/family.py @@ -4209,12 +4209,20 @@ return self.namespace(code, 14, all=True)
# Methods + def ssl_available(self): + """Check if SSL support is available""" + import httplib + return hasattr(httplib, "HTTPS") + def protocol(self, code): """ Can be overridden to return 'https'. Other protocols are not supported.
""" - return 'http%s' % ('', 's')[config.SSL_connection] + if self.ssl_available(): + return 'http%s' % ('', 's')[config.SSL_connection] + else: + return 'http'
def hostname(self, code): """The hostname to use for standard http connections.""" @@ -4867,4 +4875,7 @@ return ('commons', 'commons')
def protocol(self, code): - return 'https' + if self.ssl_available(): + return 'https' + else: + return 'http'
pywikibot-commits@lists.wikimedia.org