Testing and fixing

This commit is contained in:
Frisk 2023-08-14 18:11:24 +02:00
parent 0d672f7519
commit 9b25fbb6e4
2 changed files with 4 additions and 2 deletions

View file

@ -65,7 +65,6 @@ class AioIRCCat(irc.client_aio.AioSimpleIRCClient):
self.updated_wikis.add(full_url) self.updated_wikis.add(full_url)
logger.debug("New website appended to the list! {}".format(full_url)) logger.debug("New website appended to the list! {}".format(full_url))
def parse_fandom_discussion(self, message: str): def parse_fandom_discussion(self, message: str):
try: try:
post = json.loads(message) post = json.loads(message)
@ -77,6 +76,7 @@ class AioIRCCat(irc.client_aio.AioSimpleIRCClient):
return return
url = urlparse(post.get('url')) url = urlparse(post.get('url'))
full_url ="https://"+ url.netloc + recognize_langs(url.path) full_url ="https://"+ url.netloc + recognize_langs(url.path)
logger.debug(f"Checking {full_url}")
wiki = self.domain.get_wiki(full_url) wiki = self.domain.get_wiki(full_url)
if wiki and wiki.discussion_id != -1: if wiki and wiki.discussion_id != -1:
self.updated_discussions.add(full_url) self.updated_discussions.add(full_url)

View file

@ -45,6 +45,7 @@ class LimitedList(list):
def __repr__(self): def __repr__(self):
return "\n".join(self) return "\n".join(self)
class Statistics: class Statistics:
def __init__(self, rc_id: Optional[int], discussion_id: Optional[str]): def __init__(self, rc_id: Optional[int], discussion_id: Optional[str]):
self.last_request: Optional[aiohttp.web_request.Request] = None self.last_request: Optional[aiohttp.web_request.Request] = None
@ -55,7 +56,8 @@ class Statistics:
self.logs: LimitedList[Log] = LimitedList() self.logs: LimitedList[Log] = LimitedList()
def __str__(self): def __str__(self):
return f"<last_request={self.last_request}, last_checked_rc={self.last_checked_rc}, last_action={last_action}, last_checked_discussion={self.last_checked_discussion}, last_post={last_post}, logs={self.logs}>" return (f"<last_request={self.last_request}, last_checked_rc={self.last_checked_rc}, last_action={self.last_action},"
f" last_checked_discussion={self.last_checked_discussion}, last_post={self.last_post}, logs={self.logs}>")
def update(self, *args: Log, **kwargs: Union[float, int, str]): def update(self, *args: Log, **kwargs: Union[float, int, str]):
for key, value in kwargs.items(): for key, value in kwargs.items():