0

I have been using a certain python api wrapper for a while, for use of the apis for roblox.com. It works very well, and I have added in quite a few custom functions in the past for apis it didn't already include. Just recently however, I ran into a problem.

I created this function inside the wrapper, in the manner I have always done:

async def get_user_items(self, user_id):
        items = []
        baseUrl = f'https://inventory.roblox.com/v1/users/{user_id}/assets/collectibles?sortOrder=Asc&limit=100'
        r = await self.request.request(url=baseUrl, method='GET', headers={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36'})
        data = json.loads(r.content)
        for item in data['data']:
            items.append({'asset_id':item['assetId'], 'ua_id':item['serialNumber']})
        cursor = data['nextPageCursor']
        while cursor != None:
            r = await self.request.request(url=baseUrl + f'&cursor={cursor}', method='GET', headers={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36'})
            data = json.loads(r.content)
            for item in data['data']:
                
                items.append({'asset_id':item['assetId'], 'ua_id':item['serialNumber']})
            cursor = data['nextPageCursor']
        return items

The problem is, that when I test it out, it errors at the line "r = await self.request.request(url=baseUrl, method='GET', headers={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36'})".

This is the error:

Fatal error on SSL transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x000001A2EA00AB20>
transport: <_ProactorSocketTransport fd=960 read=<_OverlappedFuture cancelled>>
Traceback (most recent call last):
  File "C:\Users\KDJ\AppData\Local\Programs\Python\Python38\lib\asyncio\sslproto.py", line 685, in _process_write_backlog
    self._transport.write(chunk)
  File "C:\Users\KDJ\AppData\Local\Programs\Python\Python38\lib\asyncio\proactor_events.py", line 359, in write
    self._loop_writing(data=bytes(data))
  File "C:\Users\KDJ\AppData\Local\Programs\Python\Python38\lib\asyncio\proactor_events.py", line 395, in _loop_writing
    self._write_fut = self._loop._proactor.send(self._sock, data)
AttributeError: 'NoneType' object has no attribute 'send'
Traceback (most recent call last):
  File "C:\Users\KDJ\AppData\Local\Programs\Python\Python38\lib\asyncio\sslproto.py", line 685, in _process_write_backlog
    self._transport.write(chunk)
  File "C:\Users\KDJ\AppData\Local\Programs\Python\Python38\lib\asyncio\proactor_events.py", line 359, in write
    self._loop_writing(data=bytes(data))
  File "C:\Users\KDJ\AppData\Local\Programs\Python\Python38\lib\asyncio\proactor_events.py", line 395, in _loop_writing
    self._write_fut = self._loop._proactor.send(self._sock, data)
AttributeError: 'NoneType' object has no attribute 'send'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\KDJ\Desktop\Auto Manual Trader\main.py", line 117, in <module>
    asyncio.run(main())
  File "C:\Users\KDJ\AppData\Local\Programs\Python\Python38\lib\asyncio\runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "C:\Users\KDJ\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 616, in run_until_complete
    return future.result()
  File "C:\Users\KDJ\Desktop\Auto Manual Trader\main.py", line 112, in main
    their_user_items = await client.get_user_items(user_id)
  File "C:\Users\KDJ\Desktop\Auto Manual Trader\robloxapi\client.py", line 148, in get_user_items
    r = await self.request.request(url=baseUrl, method='GET', headers={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36'})
  File "C:\Users\KDJ\Desktop\Auto Manual Trader\robloxapi\utils\request.py", line 49, in request
    r = await self.requests.request(kwargs['method'], kwargs['url'], headers=self.headers, cookies=self.cookies, data=kwargs.get('data'))
  File "C:\Users\KDJ\AppData\Local\Programs\Python\Python38\lib\site-packages\http3\client.py", line 541, in request
    response = await self.send(
  File "C:\Users\KDJ\AppData\Local\Programs\Python\Python38\lib\site-packages\http3\client.py", line 140, in send
    response = await self.send_handling_redirects(
  File "C:\Users\KDJ\AppData\Local\Programs\Python\Python38\lib\site-packages\http3\client.py", line 177, in send_handling_redirects
    response = await self.dispatch.send(
  File "C:\Users\KDJ\AppData\Local\Programs\Python\Python38\lib\site-packages\http3\dispatch\connection_pool.py", line 130, in send
    raise exc
  File "C:\Users\KDJ\AppData\Local\Programs\Python\Python38\lib\site-packages\http3\dispatch\connection_pool.py", line 120, in send
    response = await connection.send(
  File "C:\Users\KDJ\AppData\Local\Programs\Python\Python38\lib\site-packages\http3\dispatch\connection.py", line 56, in send
    response = await self.h2_connection.send(request, timeout=timeout)
  File "C:\Users\KDJ\AppData\Local\Programs\Python\Python38\lib\site-packages\http3\dispatch\http2.py", line 43, in send
    stream_id = await self.send_headers(request, timeout)
  File "C:\Users\KDJ\AppData\Local\Programs\Python\Python38\lib\site-packages\http3\dispatch\http2.py", line 86, in send_headers
    await self.writer.write(data_to_send, timeout)
  File "C:\Users\KDJ\AppData\Local\Programs\Python\Python38\lib\site-packages\http3\concurrency.py", line 129, in write
    self.stream_writer.write(data)
  File "C:\Users\KDJ\AppData\Local\Programs\Python\Python38\lib\asyncio\streams.py", line 341, in write
    self._transport.write(data)
  File "C:\Users\KDJ\AppData\Local\Programs\Python\Python38\lib\asyncio\sslproto.py", line 387, in write
    self._ssl_protocol._write_appdata(data)
  File "C:\Users\KDJ\AppData\Local\Programs\Python\Python38\lib\asyncio\sslproto.py", line 599, in _write_appdata
    self._process_write_backlog()
  File "C:\Users\KDJ\AppData\Local\Programs\Python\Python38\lib\asyncio\sslproto.py", line 707, in _process_write_backlog
    self._fatal_error(exc, 'Fatal error on SSL transport')
  File "C:\Users\KDJ\AppData\Local\Programs\Python\Python38\lib\asyncio\sslproto.py", line 721, in _fatal_error
    self._transport._force_close(exc)
  File "C:\Users\KDJ\AppData\Local\Programs\Python\Python38\lib\asyncio\proactor_events.py", line 151, in _force_close
    self._loop.call_soon(self._call_connection_lost, exc)
  File "C:\Users\KDJ\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 719, in call_soon
    self._check_closed()
  File "C:\Users\KDJ\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 508, in _check_closed
    raise RuntimeError('Event loop is closed')

It seems to have something to due with asyncio. I've been trying to find a solution, but I can't seem to prevent getting that error.

Things I've tried: Reinstalling asyncio with —no-cache-dir Reinstalling my wrapper( I'm pretty sure that wrapper has nothing to due with the issue ) Researching the error( I couldn't find anything that seems related to what I'm doing )

It's such a simple request function, but for some reason the request( r = await self.request.request... ) breaks asyncio.

Does anyone have a solution, or even a clue to what's going on? Tell me if you would like to see the entirety of the code. Thanks!

KDJ
  • 105
  • 1
  • 2
  • 9

0 Answers0