Transformed the main RC fetching function to use new API requesting function

This commit is contained in:
Frisk 2021-05-22 16:54:14 +02:00
parent fd03d58a0c
commit 28e8c91871
No known key found for this signature in database
GPG key ID: 213F7C15068AF8AC

View file

@ -119,17 +119,14 @@ class Wiki(object):
"""Make a typical MW request for rc/abuselog """Make a typical MW request for rc/abuselog
If succeeds return the .json() of request and if not raises ConnectionError""" If succeeds return the .json() of request and if not raises ConnectionError"""
request = self._safe_request(WIKI_API_PATH, params=self.construct_params(amount)) try:
if request is not None: request = self.api_request(self.construct_params(amount))
try: except (ServerError, MediaWikiError):
request = request.json() raise ConnectionError
except ValueError: except (ClientError, KeyError, BadRequest):
logger.warning("ValueError in fetching changes") raise
logger.warning("Changes URL:" + request.url) return request
self.downtime_controller(True)
raise ConnectionError
return request
raise ConnectionError
def construct_params(self, amount): def construct_params(self, amount):
"""Constructs GET parameters for recentchanges/abuselog fetching feature""" """Constructs GET parameters for recentchanges/abuselog fetching feature"""