fadushin / esp8266

This repository contains source code for the ESP8266.
BSD 2-Clause "Simplified" License
73 stars 22 forks source link

Added example-asyncio #7

Closed bmsleight closed 6 years ago

bmsleight commented 7 years ago

Closes #6

Hi Fred,

Thanks for the response. I managed to get Picoweb and asyncio to play nicely. https://github.com/pfalcon/picoweb/issues/7#issuecomment-306634031

So applied the same (simple!) technique to uhttpd,

import asyncio_uhttpd
INFO:None:uhttpd-master running...
Yeehaw!
Yeehaw!
Yeehaw!
Yeehaw!
Yeehaw!
{'http': {'path': '/api/test', 'prefix': '/api', 'verb': 'get', 'headers': {'user-agent': 'curl/7.47.0', 'host': '192.168.1.228', 'accept': '*/*'}, 'tcp': {'remote_addr': ('192.168.1.127', 37980)}, 'protocol': 'HTTP/1.1'}, 'prefix': ['test'], 'context': [], 'query_params': None, 'body': None}
Yeehaw!
Yeehaw!
Yeehaw!
Yeehaw!
{'http': {'path': '/api/test', 'prefix': '/api', 'verb': 'get', 'headers': {'user-agent': 'curl/7.47.0', 'host': '192.168.1.228', 'accept': '*/*'}, 'tcp': {'remote_addr': ('192.168.1.127', 37982)}, 'protocol': 'HTTP/1.1'}, 'prefix': ['test'], 'context': [], 'query_params': None, 'body': None}
Yeehaw!
Yeehaw!
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "asyncio_uhttpd.py", line 24, in <module>
  File "uhttpd.py", line 70, in run
  File "uhttpd.py", line 407, in run
  File "uasyncio/core.py", line 64, in run_forever
  File "uasyncio/__init__.py", line 58, in wait
KeyboardInterrupt: 
>>>