Fix API request with verify=False

This commit is contained in:
Pierre Berthe 2024-02-12 23:07:12 +01:00
parent 250ed0e40f
commit 36b9f2efda

4
bot.py
View file

@ -85,7 +85,7 @@ class MyClient(discord.Client):
@tasks.loop(time=mid) @tasks.loop(time=mid)
async def quote_task(self): async def quote_task(self):
channel = self.get_channel(GENERAL_CHANNEL_ID) channel = self.get_channel(GENERAL_CHANNEL_ID)
response = get("https://api.quotable.io/random?maxLength=230") response = get("https://api.quotable.io/random?maxLength=230", verify=False)
my_quote = response.json() my_quote = response.json()
await channel.send(embed=embed_from_quote(my_quote)) await channel.send(embed=embed_from_quote(my_quote))
@ -168,7 +168,7 @@ async def translate(interaction: discord.Interaction, message: discord.Message):
@client.tree.command() @client.tree.command()
async def quote(interaction: discord.Interaction): async def quote(interaction: discord.Interaction):
"""Sends a random quote.""" """Sends a random quote."""
response = get('https://api.quotable.io/random?maxLength=230') response = get('https://api.quotable.io/random?maxLength=230', verify=False)
my_quote = response.json() my_quote = response.json()
await interaction.response.send_message(embed=embed_from_quote(my_quote)) await interaction.response.send_message(embed=embed_from_quote(my_quote))