elliejs / Willump

A Python3 Helper Library for The League of Legends LCU API
MIT License
69 stars 4 forks source link

Cannot start simple app #3

Closed nubonics closed 2 years ago

nubonics commented 2 years ago

I've followed the guide on the nunu docs, however, i am unable to replicate a working example.

example.py

import asyncio
import willump

async def get_my_summoner_id(conn):
    response = await conn.request('get', '/lol-summoner/v1/current-summoner')
    # request can be used to execute 'get', as well as any other http method
    print(await response.json())

async def main():
    will = await willump.start()
    nu = await will.start_nunu(Allow_Origin='AMERICAS', ssl_key_path='C:/ssl/KEYNAME.pem')
    await get_my_summoner_id(conn=nu)
    await will.close()
    await nu.close()

if __name__ == '__main__':
    asyncio.run(main())

traceback

WARNING:root:couldn't find LCUx process yet. Re-searching process list...
Traceback (most recent call last):
  File "C:\Users\Sylar6\PycharmProjects\Lauto2\modules\tests\nunu_t1.py", line 21, in <module>
    asyncio.run(main())
  File "C:\Users\Sylar6\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Users\Sylar6\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 646, in run_until_complete
    return future.result()
  File "C:\Users\Sylar6\PycharmProjects\Lauto2\modules\tests\nunu_t1.py", line 14, in main
    nu = await will.start_nunu(Allow_Origin='AMERICAS', ssl_key_path='C:/ssl/KEYNAME.pem')
TypeError: object NoneType can't be used in 'await' expression
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x0000025BA7EAE8F0>
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x0000025BA800CBB0>
ERROR:asyncio:Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x0000025BA7FD5420>, 382788.203)]']
connector: <aiohttp.connector.TCPConnector object at 0x0000025BA800CA00>
ERROR:asyncio:Fatal error on SSL transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x0000025BA800D990>
transport: <_ProactorSocketTransport fd=1996 read=<_OverlappedFuture cancelled>>
Traceback (most recent call last):
  File "C:\Users\Sylar6\AppData\Local\Programs\Python\Python310\lib\asyncio\sslproto.py", line 690, in _process_write_backlog
    self._transport.write(chunk)
  File "C:\Users\Sylar6\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 361, in write
    self._loop_writing(data=bytes(data))
  File "C:\Users\Sylar6\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 397, in _loop_writing
    self._write_fut = self._loop._proactor.send(self._sock, data)
AttributeError: 'NoneType' object has no attribute 'send'
Exception ignored in: <function ClientResponse.__del__ at 0x0000025BA7DA57E0>
Traceback (most recent call last):
  File "C:\Users\Sylar6\PycharmProjects\Lauto2\venv\lib\site-packages\aiohttp\client_reqrep.py", line 810, in __del__
  File "C:\Users\Sylar6\PycharmProjects\Lauto2\venv\lib\site-packages\aiohttp\connector.py", line 178, in release
  File "C:\Users\Sylar6\PycharmProjects\Lauto2\venv\lib\site-packages\aiohttp\connector.py", line 665, in _release
  File "C:\Users\Sylar6\PycharmProjects\Lauto2\venv\lib\site-packages\aiohttp\client_proto.py", line 63, in close
  File "C:\Users\Sylar6\AppData\Local\Programs\Python\Python310\lib\asyncio\sslproto.py", line 316, in close
  File "C:\Users\Sylar6\AppData\Local\Programs\Python\Python310\lib\asyncio\sslproto.py", line 599, in _start_shutdown
  File "C:\Users\Sylar6\AppData\Local\Programs\Python\Python310\lib\asyncio\sslproto.py", line 604, in _write_appdata
  File "C:\Users\Sylar6\AppData\Local\Programs\Python\Python310\lib\asyncio\sslproto.py", line 712, in _process_write_backlog
  File "C:\Users\Sylar6\AppData\Local\Programs\Python\Python310\lib\asyncio\sslproto.py", line 726, in _fatal_error
  File "C:\Users\Sylar6\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 151, in _force_close
  File "C:\Users\Sylar6\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 750, in call_soon
  File "C:\Users\Sylar6\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 515, in _check_closed
RuntimeError: Event loop is closed
ERROR:asyncio:Fatal error on SSL transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x0000025BA800CDF0>
transport: <_ProactorSocketTransport fd=1988 read=<_OverlappedFuture cancelled>>
Traceback (most recent call last):
  File "C:\Users\Sylar6\AppData\Local\Programs\Python\Python310\lib\asyncio\sslproto.py", line 690, in _process_write_backlog
    self._transport.write(chunk)
  File "C:\Users\Sylar6\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 361, in write
    self._loop_writing(data=bytes(data))
  File "C:\Users\Sylar6\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 397, in _loop_writing
    self._write_fut = self._loop._proactor.send(self._sock, data)
AttributeError: 'NoneType' object has no attribute 'send'
Exception ignored in: <function _SSLProtocolTransport.__del__ at 0x0000025BA749DF30>
Traceback (most recent call last):
  File "C:\Users\Sylar6\AppData\Local\Programs\Python\Python310\lib\asyncio\sslproto.py", line 321, in __del__
  File "C:\Users\Sylar6\AppData\Local\Programs\Python\Python310\lib\asyncio\sslproto.py", line 316, in close
  File "C:\Users\Sylar6\AppData\Local\Programs\Python\Python310\lib\asyncio\sslproto.py", line 599, in _start_shutdown
  File "C:\Users\Sylar6\AppData\Local\Programs\Python\Python310\lib\asyncio\sslproto.py", line 604, in _write_appdata
  File "C:\Users\Sylar6\AppData\Local\Programs\Python\Python310\lib\asyncio\sslproto.py", line 712, in _process_write_backlog
  File "C:\Users\Sylar6\AppData\Local\Programs\Python\Python310\lib\asyncio\sslproto.py", line 726, in _fatal_error
  File "C:\Users\Sylar6\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 151, in _force_close
  File "C:\Users\Sylar6\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 750, in call_soon
  File "C:\Users\Sylar6\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 515, in _check_closed
RuntimeError: Event loop is closed

Process finished with exit code 1
elliejs commented 2 years ago

1) Allow_Origin='AMERICAS', is incorrect. this is a website origin, not a shard region from the riot api. either supply the url you own, or '*' 2) I bet 'C:/ssl/KEYNAME.pem' doesn't exist.