I’m trying to make requests to the Roblox cloud API (UserRestrictions) in Python using the aiohttp library. My code was working perfectly until today when it suddenly stopped with no changes to the environment.
The error in question is aiohttp.client_exceptions.ClientOSError: [Errno 104] Connection reset by peer
. I made a test script to see if it was related to the headers I was using, but it seems to be affecting requests to any roblox.com
domain. I’ve restarted the system (ubuntu 24.04) numerous times, cleared the DNS cache and reinstalled the packages, but the issue persists. Running curl https://apis.roblox.com/
works completely fine, so I don’t think it’s a rate limit.
I’m unable to replicate this error on other systems.
import asyncio, aiohttp
async def run():
async with aiohttp.ClientSession() as Session:
Request = await Session.get("https://google.com/") # Doesn't error
print(await Request.text())
Request = await Session.get("https://apis.roblox.com/") # Does error
print(await Request.text())
asyncio.run(run())
Full Error
Traceback (most recent call last):
File "/usr/lib/python3.12/asyncio/selector_events.py", line 988, in _read_ready__get_buffer
nbytes = self._sock.recv_into(buf)
^^^^^^^^^^^^^^^^^^^^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "./env/lib/python3.12/site-packages/discord/client.py", line 481, in _run_event
await coro(*args, **kwargs)
File "./main.py", line 69, in on_ready
Request = await Session.get(
^^^^^^^^^^^^^^^^^^
File "./env/lib/python3.12/site-packages/aiohttp/client.py", line 770, in _request
resp = await handler(req)
^^^^^^^^^^^^^^^^^^
File "./env/lib/python3.12/site-packages/aiohttp/client.py", line 748, in _connect_and_send_request
await resp.start(conn)
File "./env/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 532, in start
message, payload = await protocol.read() # type: ignore[union-attr]
^^^^^^^^^^^^^^^^^^^^^
File "./env/lib/python3.12/site-packages/aiohttp/streams.py", line 672, in read
await self._waiter
aiohttp.client_exceptions.ClientOSError: [Errno 104] Connection reset by peer
ANY help will be HEAVILY appreciated. If Roblox Devforum isn’t exactly the right place to post this, please point me in the right direction. I’ve been at this for multiple hours🙏