From af6b8c191543fca505322df1b0cd3e7b6605d789 Mon Sep 17 00:00:00 2001 From: Henrik Boeving Date: Tue, 3 Jul 2018 20:02:39 +0200 Subject: change the pep fetch URL based on the PEP number because newer peps are written in RST instead of normal txt --- bot/cogs/utils.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bot/cogs/utils.py b/bot/cogs/utils.py index ee1f0a199..7b11f521c 100644 --- a/bot/cogs/utils.py +++ b/bot/cogs/utils.py @@ -30,8 +30,13 @@ class Utils: Fetches information about a PEP and sends it to the channel. """ - # Attempt to fetch the PEP from Github. - pep_url = f"{self.base_github_pep_url}{pep_number.zfill(4)}.txt" + # Newer PEPs are written in RST instead of txt + if int(pep_number) > 542: + pep_url = f"{self.base_github_pep_url}{pep_number.zfill(4)}.rst" + else: + pep_url = f"{self.base_github_pep_url}{pep_number.zfill(4)}.txt" + + # Attempt to fetch the PEP log.trace(f"Requesting PEP {pep_number} with {pep_url}") response = await self.bot.http_session.get(pep_url) -- cgit v1.2.3