belyalov / tinyweb

Simple and lightweight HTTP async server for micropython
MIT License
247 stars 40 forks source link

Fix generator_type fix #40

Closed JackBurdick closed 3 years ago

JackBurdick commented 3 years ago

The example here does not work for me as expected.

I encountered an error when checking the type the res.

I'm running MicroPython v1.13 and both >>> import uasyncio as asyncio >>> import uasyncio.core run as expected. My uasyncio version appears to be (3, 0, 0).

This change also appears to be implemented in (https://github.com/belyalov/tinyweb/blob/new_uasync_io/tinyweb/server.py) but is a stand-alone fix.

I see that this method is also how the type_gen is created by uasyncio.core here, but does not appear present in my version

>>> import uasyncio.core.
__class__       __name__        __file__        CancelledError
Task            TaskQueue       _task_queue     cur_task
run             select          sleep           sleep_ms
sys             ticks_add       ticks_diff      ticks
TimeoutError    _exc_context    SingletonGenerator
IOQueue         _promote_to_task                create_task
run_until_complete              _stopper        _stop_task
Loop            get_event_loop  new_event_loop  _io_queue

I'm happy to close/modify/raise an issue instead, but the included fix was necessary for me to work based on current documentation in the readme.

I also don't trust myself enough to write tests that spin up the server and check these types so I'm leaving off.

Happy holidays!