diff options
| author | 2020-12-23 17:31:03 +0200 | |
|---|---|---|
| committer | 2020-12-23 17:31:03 +0200 | |
| commit | dd546b8970f9643dd1ff4a2f09c8a675d6bec5a8 (patch) | |
| tree | 81660ad5af4dd9bf93f8a5c526e657634eeebdc9 | |
| parent | Merge branch 'master' into ks123/pep (diff) | |
Move constants out from class
| -rw-r--r-- | bot/exts/utils/pep.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/bot/exts/utils/pep.py b/bot/exts/utils/pep.py index 873f32a8e..8ac96bbdb 100644 --- a/bot/exts/utils/pep.py +++ b/bot/exts/utils/pep.py @@ -14,6 +14,8 @@ from bot.utils.cache import AsyncCache log = logging.getLogger(__name__) ICON_URL = "https://www.python.org/static/opengraph-icon-200x200.png" +BASE_PEP_URL = "http://www.python.org/dev/peps/pep-" +PEPS_LISTING_API_URL = "https://api.github.com/repos/python/peps/contents?ref=master" pep_cache = AsyncCache() @@ -25,9 +27,6 @@ if Keys.github: class PythonEnhancementProposals(Cog): """Cog for displaying information about PEPs.""" - BASE_PEP_URL = "http://www.python.org/dev/peps/pep-" - PEPS_LISTING_API_URL = "https://api.github.com/repos/python/peps/contents?ref=master" - def __init__(self, bot: Bot): self.bot = bot self.peps: Dict[int, str] = {} @@ -43,7 +42,7 @@ class PythonEnhancementProposals(Cog): self.last_refreshed_peps = datetime.now() async with self.bot.http_session.get( - self.PEPS_LISTING_API_URL, + PEPS_LISTING_API_URL, headers=GITHUB_API_HEADERS ) as resp: if resp.status != 200: @@ -100,7 +99,7 @@ class PythonEnhancementProposals(Cog): # Assemble the embed pep_embed = Embed( title=f"**PEP {pep_nr} - {pep_header['Title']}**", - description=f"[Link]({self.BASE_PEP_URL}{pep_nr:04})", + description=f"[Link]({BASE_PEP_URL}{pep_nr:04})", ) pep_embed.set_thumbnail(url=ICON_URL) |