fix: Add headers to aiohttp ClientSession for UploadCog

This commit is contained in:
Slipstream 2025-05-21 11:20:19 -06:00
parent 6549a5c324
commit 35546ed55b
Signed by: slipstream
GPG Key ID: 13E498CE010AC6FD

View File

@ -38,6 +38,9 @@ class UploadCog(commands.Cog, name="Upload"):
self.api_base_url = "https://upload.slipstreamm.dev/upload"
self.session = None
self.captcha_cache = {} # Store captcha IDs temporarily
self.headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36"
}
print("UploadCog initialized!")
# Create command group
@ -55,7 +58,7 @@ class UploadCog(commands.Cog, name="Upload"):
async def cog_load(self):
"""Called when the cog is loaded."""
self.session = aiohttp.ClientSession()
self.session = aiohttp.ClientSession(headers=self.headers)
print("UploadCog session created")
async def cog_unload(self):
@ -83,7 +86,7 @@ class UploadCog(commands.Cog, name="Upload"):
async def _make_api_request(self, method: str, endpoint: str, **kwargs) -> Dict[str, Any]:
"""Make a request to the API"""
if not self.session:
self.session = aiohttp.ClientSession()
self.session = aiohttp.ClientSession(headers=self.headers)
# Ensure the endpoint starts with a slash
if not endpoint.startswith("/"):