diff --git a/extensions/addons/cogs/otheraddons.py b/extensions/addons/cogs/otheraddons.py
index 56208de..f4c7340 100644
--- a/extensions/addons/cogs/otheraddons.py
+++ b/extensions/addons/cogs/otheraddons.py
@@ -1,6 +1,6 @@
import json # to read API json responses
-import requests # to read api calls
+import aiohttp
import discord
import discord.app_commands as app_commands
import discord.ext.commands as commands
@@ -297,11 +297,8 @@ async def convert_unit(
"appid": itx.client.api_tokens['Open Exchange Rates'],
"show_alternative": "true",
}
- response_api = requests.get(
- "https://openexchangerates.org/api/latest.json",
- params=params
- ).text
- data = json.loads(response_api)
+ async with aiohttp.ClientSession() as client, client.get("https://openexchangerates.org/api/latest.json", params=params) as response:
+ data = await response.json()
if data.get("error", 0):
await itx.response.send_message(
"I'm sorry, something went wrong while trying to get "
diff --git a/extensions/addons/cogs/searchaddons.py b/extensions/addons/cogs/searchaddons.py
index a621140..e823df9 100644
--- a/extensions/addons/cogs/searchaddons.py
+++ b/extensions/addons/cogs/searchaddons.py
@@ -1,6 +1,7 @@
import json # to read API json responses
-import requests # to read api calls
+import aiohttp # to read api calls
+import aiohttp.client_exceptions
import discord
import discord.app_commands as app_commands
@@ -375,11 +376,8 @@ async def equaldex(self, itx: discord.Interaction[Bot], country_id: str):
"apiKey": equaldex_key,
# "formatted": "true",
}
- response = requests.get(
- "https://www.equaldex.com/api/region",
- params=querystring
- )
- response_api = response.text
+ async with aiohttp.ClientSession() as client, client.get("https://www.equaldex.com/api/region", params=querystring) as response:
+ response_api = await response.text()
# returns ->
{"regions":{...}} <- so you need to
# remove the and
parts. It also has some
#
\r\n strings in there for some reason...? so uh
@@ -505,11 +503,9 @@ async def math(self, itx: discord.Interaction[Bot], query: str):
"output": "json",
}
try:
- api_response: WolframResult = requests.get(
- "https://api.wolframalpha.com/v2/query",
- params=params
- ).json()
- except requests.exceptions.JSONDecodeError:
+ async with aiohttp.ClientSession() as client, client.get("https://api.wolframalpha.com/v2/query", params=params) as response:
+ api_response: WolframResult = await response.json()
+ except (aiohttp.client_exceptions.ContentTypeError, json.JSONDecodeError):
await itx.followup.send(
"Your input gave a malformed result! Perhaps it took "
"too long to calculate...",
diff --git a/extensions/staffaddons/cogs/staffaddons.py b/extensions/staffaddons/cogs/staffaddons.py
index 9f30a5f..e142663 100644
--- a/extensions/staffaddons/cogs/staffaddons.py
+++ b/extensions/staffaddons/cogs/staffaddons.py
@@ -1,8 +1,7 @@
from datetime import datetime, timedelta
# ^ for /delete_week_selfies (within 7 days), and /version startup
# time parsing to discord unix
-import requests
-# to fetch from GitHub and see Rina is running the latest version
+import aiohttp # to fetch from GitHub and see Rina is running the latest version
import discord
import discord.app_commands as app_commands
@@ -171,9 +170,8 @@ async def delete_week_selfies(self, itx: discord.Interaction[Bot]):
async def get_bot_version(self, itx: discord.Interaction[Bot]):
# get most recently pushed bot version
# noinspection LongLine
- latest_rina = requests.get(
- "https://raw.githubusercontent.com/TransPlace-Devs/uncute-rina/main/main.py" # noqa
- ).text
+ async with aiohttp.ClientSession() as client, client.get("https://raw.githubusercontent.com/TransPlace-Devs/uncute-rina/main/main.py") as response:
+ latest_rina = await response.text()
latest_version = (latest_rina
.split("BOT_VERSION = \"", 1)[1]
.split("\"", 1)[0])
diff --git a/requirements.txt b/requirements.txt
index 3af5c74..7e4187d 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -5,6 +5,5 @@ pymongo>=4.14.0
pandas>=2.3.1
apscheduler>=3.11.0
matplotlib>=3.10.5
-requests>=2.32.3
pytest>=8.4.1
aiohttp>=3.12.15