Fixed a bug

This commit is contained in:
Frisk 2018-12-30 19:57:29 +01:00
parent 0c6820217c
commit 882f3ebbea
No known key found for this signature in database
GPG key ID: 0E9A7D3C0A01586C

View file

@ -1084,14 +1084,17 @@ class Recent_Changes_Class(object):
startup_info = safe_read(self.safe_request( startup_info = safe_read(self.safe_request(
"https://{wiki}.gamepedia.com/api.php?action=query&format=json&uselang=content&list=tags|recentchanges&meta=allmessages&utf8=1&tglimit=max&tgprop=name|displayname&ammessages=recentchanges-page-added-to-category|recentchanges-page-removed-from-category&amenableparser=1&amincludelocal=1".format( "https://{wiki}.gamepedia.com/api.php?action=query&format=json&uselang=content&list=tags|recentchanges&meta=allmessages&utf8=1&tglimit=max&tgprop=name|displayname&ammessages=recentchanges-page-added-to-category|recentchanges-page-removed-from-category&amenableparser=1&amincludelocal=1".format(
wiki=settings["wiki"])), "query") wiki=settings["wiki"])), "query")
if "tags" in startup_info and "allmessages" in startup_info: if startup_info:
for tag in startup_info["tags"]: if "tags" in startup_info and "allmessages" in startup_info:
self.tags[tag["name"]] = (BeautifulSoup(tag["displayname"], "lxml")).get_text() for tag in startup_info["tags"]:
for message in startup_info["allmessages"]: self.tags[tag["name"]] = (BeautifulSoup(tag["displayname"], "lxml")).get_text()
self.mw_messages[message["name"]] = message["*"] for message in startup_info["allmessages"]:
self.mw_messages[message["name"]] = message["*"]
else:
logging.warning("Could not retrieve initial wiki information. Some features may not work correctly!")
logging.debug(startup_info)
else: else:
logging.warning("Could not retrieve initial wiki information. Some features may not work correctly!") logging.error("Could not retrieve initial wiki information. Possibly internet connection issue?")
logging.debug(startup_info)
recent_changes = Recent_Changes_Class() recent_changes = Recent_Changes_Class()