jenkins-bot merged this change.
[cleanup] Remove Python 2/3 code duplication
Change-Id: Id2462056f281ff8ce83f2603fc0257c50143fc39
---
M pywikibot/specialbots/__init__.py
1 file changed, 5 insertions(+), 6 deletions(-)
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: "
To view, visit change 591034. To unsubscribe, or for help writing mail filters, visit settings.