I am trying to make a program to process HTTP headers using uasyncio's start_server class, I can see the name headers I am trying to read in Access-Control-Request-Headers
after printing the data received from a web request but cannot read the actual data stored in the headers.
Relevant Code:
async def conn(reader, writer):
try:
while True:
res = await reader.read(4096)
if(str(res) != "b''"):
print(res)
writer.write("Recieved!")
await writer.drain()
except:
print("Err")
print("Client disconnected")
reader.wait_closed()
async def main():
anim = uasyncio.create_task(animation())
serv = await uasyncio.start_server(conn, '0.0.0.0', 80, 10)
while True:
await uasyncio.sleep_ms(1000)
Is anyone able to point me in the right direction or link some example code to read the headers?