From e2d1d1fc871c4fdb4d7543673c9efa8b8205fb02 Mon Sep 17 00:00:00 2001 From: 0x5c Date: Mon, 13 Jun 2022 08:39:21 -0400 Subject: [PATCH] Fix aiohttp/apache http2 bug in ?muf and ?fof2 For more info, https://github.com/aio-libs/aiohttp/issues/3904 It is not possible to fix it by bumping aiohttp since it is pinned by another dependency. --- CHANGELOG.md | 2 ++ exts/propagation.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd062bb..234f5d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] +### Fixed +- Issue where `?muf` and `?fof2` would fail with an aiohttp error. ## [2.7.5] - 2022-06-08 diff --git a/exts/propagation.py b/exts/propagation.py index e46ad7d..f7a68e4 100644 --- a/exts/propagation.py +++ b/exts/propagation.py @@ -33,7 +33,7 @@ class PropagationCog(commands.Cog): async def mufmap(self, ctx: commands.Context): """Shows a world map of the Maximum Usable Frequency (MUF).""" async with ctx.typing(): - async with self.session.get(self.muf_url) as r: + async with self.session.get(self.muf_url, headers={"Connection": "Upgrade", "Upgrade": "http/1.1"}) as r: svg = await r.read() out = BytesIO(cairosvg.svg2png(bytestring=svg)) file = discord.File(out, "muf_map.png") @@ -47,7 +47,7 @@ class PropagationCog(commands.Cog): async def fof2map(self, ctx: commands.Context): """Shows a world map of the Critical Frequency (foF2).""" async with ctx.typing(): - async with self.session.get(self.fof2_url) as r: + async with self.session.get(self.fof2_url, headers={"Connection": "Upgrade", "Upgrade": "http/1.1"}) as r: svg = await r.read() out = BytesIO(cairosvg.svg2png(bytestring=svg)) file = discord.File(out, "fof2_map.png")