jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/591034 )
Change subject: [cleanup] Remove Python 2/3 code duplication ......................................................................
[cleanup] Remove Python 2/3 code duplication
Change-Id: Id2462056f281ff8ce83f2603fc0257c50143fc39 --- M pywikibot/specialbots/__init__.py 1 file changed, 5 insertions(+), 6 deletions(-)
Approvals: Dvorapa: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/specialbots/__init__.py b/pywikibot/specialbots/__init__.py index 5edc96a..6f23d5a 100644 --- a/pywikibot/specialbots/__init__.py +++ b/pywikibot/specialbots/__init__.py @@ -147,13 +147,12 @@ info = infile.info()
if PY2: - content_type = info.getheader('Content-Type') - content_len = info.getheader('Content-Length') - accept_ranges = info.getheader('Accept-Ranges') + info_get = info.getheader else: - content_type = info.get('Content-Type') - content_len = info.get('Content-Length') - accept_ranges = info.get('Accept-Ranges') + info_get = info.get + content_type = info_get('Content-Type') + content_len = info_get('Content-Length') + accept_ranges = info_get('Accept-Ranges')
if 'text/html' in content_type: pywikibot.output("Couldn't download the image: "
pywikibot-commits@lists.wikimedia.org