diff options
-rw-r--r-- | arthur/apis/cloudflare/zones.py | 15 | ||||
-rw-r--r-- | arthur/exts/cloudflare/zones.py | 5 | ||||
-rw-r--r-- | arthur/exts/error_handler/error_handler.py | 3 | ||||
-rw-r--r-- | arthur/exts/kubernetes/deployments.py | 4 |
4 files changed, 10 insertions, 17 deletions
diff --git a/arthur/apis/cloudflare/zones.py b/arthur/apis/cloudflare/zones.py index 93c29d1..e2955f7 100644 --- a/arthur/apis/cloudflare/zones.py +++ b/arthur/apis/cloudflare/zones.py @@ -7,12 +7,11 @@ from arthur.config import CONFIG CF_TOKEN = CONFIG.cloudflare_token + async def list_zones(zone_name: Optional[str] = None) -> dict[str, str]: endpoint = f"https://api.cloudflare.com/client/v4/zones" - request_headers = { - "X-Auth-User-Service-Key": CF_TOKEN - } + request_headers = {"X-Auth-User-Service-Key": CF_TOKEN} if zone_name is not None: endpoint += f"?name={zone_name}" @@ -29,16 +28,10 @@ async def list_zones(zone_name: Optional[str] = None) -> dict[str, str]: async def purge_zone(zone_identifier: str) -> dict: endpoint = f"https://api.cloudflare.com/client/v4/zones/{zone_identifier}/purge_cache?purge_everything=true" - request_headers = { - "X-Auth-User-Service-Key": CF_TOKEN - } + request_headers = {"X-Auth-User-Service-Key": CF_TOKEN} async with aiohttp.ClientSession() as session: async with session.post(endpoint, headers=request_headers) as response: info = await response.json() - - return { - "success": info["success"], - "errors": info["errors"] - } + return {"success": info["success"], "errors": info["errors"]} diff --git a/arthur/exts/cloudflare/zones.py b/arthur/exts/cloudflare/zones.py index 20169bc..3b8b3b7 100644 --- a/arthur/exts/cloudflare/zones.py +++ b/arthur/exts/cloudflare/zones.py @@ -6,8 +6,8 @@ from discord.ext import commands from arthur.apis.cloudflare import zones from arthur.bot import KingArthur -class Zones(commands.Cog): +class Zones(commands.Cog): def __init__(self, bot: KingArthur) -> None: self.bot = bot @@ -38,6 +38,7 @@ class Zones(commands.Cog): message += f"**Message**: {error.message}\n" return await ctx.send(message) + def setup(bot: KingArthur) -> None: """Add the extension to the bot.""" - bot.add_cog(Zones(bot))
\ No newline at end of file + bot.add_cog(Zones(bot)) diff --git a/arthur/exts/error_handler/error_handler.py b/arthur/exts/error_handler/error_handler.py index 2a61f40..673fbc7 100644 --- a/arthur/exts/error_handler/error_handler.py +++ b/arthur/exts/error_handler/error_handler.py @@ -49,8 +49,7 @@ class ErrorHandler(Cog): await ctx.send( generate_error_message( description=( - f"Unknown exception occurred: `{error.__class__.__name__}:" - f" {error}`" + f"Unknown exception occurred: `{error.__class__.__name__}:" f" {error}`" ) ) ) diff --git a/arthur/exts/kubernetes/deployments.py b/arthur/exts/kubernetes/deployments.py index dccf676..dc1284f 100644 --- a/arthur/exts/kubernetes/deployments.py +++ b/arthur/exts/kubernetes/deployments.py @@ -134,14 +134,14 @@ class Deployments(commands.Cog): content=generate_error_message( description="Could not find deployment, check the namespace.", ), - ephemeral=False + ephemeral=False, ) return await interaction.respond( content=generate_error_message( description=f"Unexpected error occurred, error code {e.status}" ), - ephemeral=False + ephemeral=False, ) else: description = ( |