[MediaWiki-commits] [Gerrit] [bugfix] pay attention to requests connection error - change (pywikibot...xqbot)

2016-06-23 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: [bugfix] pay attention to requests connection error
..


[bugfix] pay attention to requests connection error

Change-Id: I5813ceae1cf687db08605cfc19a7b82c76bd4fd4
---
M afd_notice.py
1 file changed, 7 insertions(+), 2 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/afd_notice.py b/afd_notice.py
index 7aecdd1..8b49ca6 100644
--- a/afd_notice.py
+++ b/afd_notice.py
@@ -30,7 +30,7 @@
 import pywikibot
 from pywikibot import config, pagegenerators, textlib
 from pywikibot.bot import ExistingPageBot, SingleSiteBot
-from pywikibot.comms.http import fetch
+from pywikibot.comms.http import fetch, requests
 
 msg = u'{{ers:user:xqbot/LD-Hinweis|%(page)s|%(action)s}}'
 opt_out = u'Benutzer:Xqbot/Opt-out:LD-Hinweis'
@@ -202,7 +202,12 @@
 return
 url = ('https://tools.wmflabs.org/wikihistory/dewiki/getauthors.php?'
'page_id=%s' % page._pageid)
-r = fetch(url)
+try:
+r = fetch(url)
+except requests.exceptions.ConnectionError:
+pywikibot.exception()
+# TODO: implement fallback or save list to inform later
+return
 if r.status not in (200, ):
 pywikibot.warning('wikihistory request status is %d' % r.status)
 return  # TODO: try again?

-- 
To view, visit https://gerrit.wikimedia.org/r/295715
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5813ceae1cf687db08605cfc19a7b82c76bd4fd4
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/bots/xqbot
Gerrit-Branch: master
Gerrit-Owner: Xqt 
Gerrit-Reviewer: Xqt 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] [bugfix] pay attention to requests connection error - change (pywikibot...xqbot)

2016-06-23 Thread Xqt (Code Review)
Xqt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/295715

Change subject: [bugfix] pay attention to requests connection error
..

[bugfix] pay attention to requests connection error

Change-Id: I5813ceae1cf687db08605cfc19a7b82c76bd4fd4
---
M afd_notice.py
1 file changed, 7 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/bots/xqbot 
refs/changes/15/295715/1

diff --git a/afd_notice.py b/afd_notice.py
index 7aecdd1..a4f6d02 100644
--- a/afd_notice.py
+++ b/afd_notice.py
@@ -30,7 +30,7 @@
 import pywikibot
 from pywikibot import config, pagegenerators, textlib
 from pywikibot.bot import ExistingPageBot, SingleSiteBot
-from pywikibot.comms.http import fetch
+from pywikibot.comms.http import requests, fetch
 
 msg = u'{{ers:user:xqbot/LD-Hinweis|%(page)s|%(action)s}}'
 opt_out = u'Benutzer:Xqbot/Opt-out:LD-Hinweis'
@@ -202,7 +202,12 @@
 return
 url = ('https://tools.wmflabs.org/wikihistory/dewiki/getauthors.php?'
'page_id=%s' % page._pageid)
-r = fetch(url)
+try:
+r = fetch(url)
+except requests.exceptions.ConnectionError:
+pywikibot.exception()
+# TODO: implement fallback or save list to inform later
+return
 if r.status not in (200, ):
 pywikibot.warning('wikihistory request status is %d' % r.status)
 return  # TODO: try again?

-- 
To view, visit https://gerrit.wikimedia.org/r/295715
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5813ceae1cf687db08605cfc19a7b82c76bd4fd4
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/bots/xqbot
Gerrit-Branch: master
Gerrit-Owner: Xqt 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits