diff options
| author | 2018-07-03 20:02:39 +0200 | |
|---|---|---|
| committer | 2018-07-03 20:02:39 +0200 | |
| commit | af6b8c191543fca505322df1b0cd3e7b6605d789 (patch) | |
| tree | 1096561ec694d9909a9ab0584c8a901d9f75407f | |
| parent | [Announcements] Screw it, we don't need to remove the messages (diff) | |
change the pep fetch URL based on the PEP number because newer peps are written in RST instead of normal txt
| -rw-r--r-- | bot/cogs/utils.py | 9 |
1 files 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) |