mirror of
https://gitlab.com/chicken-riders/RcGcDb.git
synced 2025-02-23 00:54:09 +00:00
fixes
This commit is contained in:
parent
54ee888f86
commit
b0bd660fb0
|
@ -5,4 +5,4 @@ nest-asyncio >= 1.4.0
|
|||
irc >= 19.0.1
|
||||
beautifulsoup4>=4.9.3
|
||||
asyncpg>=0.22.0
|
||||
aioredis >= 1.3.1
|
||||
requests>=2.31.0
|
|
@ -98,8 +98,7 @@ class Discussions:
|
|||
params = {"controller": "FeedsAndPosts", "method": "getArticleNamesAndUsernames",
|
||||
"stablePageIds": ",".join(comment_events), "format": "json"}
|
||||
comment_pages_request = await wiki.fetch_discussions(params)
|
||||
comment_pages = await comment_pages_request.json()
|
||||
comment_pages = comment_pages["articleNames"]
|
||||
comment_pages = comment_pages_request[1]["articleNames"]
|
||||
except aiohttp.ClientResponseError: # Fandom can be funny sometimes... See #30
|
||||
comment_pages = None
|
||||
except:
|
||||
|
|
16
src/wiki.py
16
src/wiki.py
|
@ -393,6 +393,22 @@ class Wiki:
|
|||
raise WikiServerError(e)
|
||||
return feeds_response, await feeds_response.json(encoding="UTF-8")
|
||||
|
||||
def pull_comment(self, comment_id):
|
||||
try:
|
||||
comment = self.sync_api_request("?action=comment&do=getRaw&comment_id={comment}&format=json".format(comment=comment_id), "text")
|
||||
logger.debug("Got the following comment from the API: {}".format(comment))
|
||||
except (ServerError, MediaWikiError):
|
||||
pass
|
||||
except (BadRequest, ClientError):
|
||||
logger.exception("Some kind of issue while creating a request (most likely client error).")
|
||||
except KeyError:
|
||||
logger.exception("CurseProfile extension API did not respond with a valid comment content.")
|
||||
else:
|
||||
if len(comment) > 1000:
|
||||
comment = comment[0:1000] + "…"
|
||||
return comment
|
||||
return ""
|
||||
|
||||
|
||||
def process_cachable(response: dict, wiki_object: Wiki) -> None:
|
||||
"""This function processes cachable objects – such as MediaWiki system messages and wiki tag display names to be used
|
||||
|
|
Loading…
Reference in a new issue