27 May 2024 |
edw4rb (edw4rb) | Will try the MDN approach | 07:11:39 |
edw4rb (edw4rb) | Thank you again | 07:11:44 |
Sam Bull | I guess if you really want to use aiohttp as the SSE client, it's should be pretty simple to just parse it manually using resp.content.readline() . The syntax is shown in https://html.spec.whatwg.org/multipage/server-sent-events.html#parsing-an-event-stream The section after that also gives a more straightforward series of steps to parse it (if you control the server side, then you may even be able to reduce that further as you know exactly what messages would be sent). | 11:44:37 |
Sam Bull | * I guess if you really want to use aiohttp as the SSE client, it should be pretty simple to just parse it manually using resp.content.readline() . The syntax is shown in https://html.spec.whatwg.org/multipage/server-sent-events.html#parsing-an-event-stream The section after that also gives a more straightforward series of steps to parse it (if you control the server side, then you may even be able to reduce that further as you know exactly what messages would be sent). | 11:44:51 |
29 May 2024 |
| jangrewe (Jan Grewe) left the room. | 23:10:56 |
1 Jun 2024 |
| Leonardo joined the room. | 12:26:01 |
9 Jun 2024 |
| Leo joined the room. | 20:46:58 |
Leo | wasn't aware that gitter was chill like this | 20:48:19 |
10 Jun 2024 |
| Sky joined the room. | 21:31:50 |
Sky | I'm trying to capture every single OPTIONS request onto a single handler, but I can't seem to figure out how to do it. I've tried: py app.router.add_route("OPTIONS", "/{tail:.*}", handle_options) app.router.add_route("OPTIONS", "*", handle_options) app.router.add_route("OPTIONS", r"^/$", handle_options) but i either get ValueError: path should be started with / or be empty or it just doesnt respond to any request | 22:15:08 |
Sky | * I'm trying to capture every single OPTIONS request onto a single handler, but I can't seem to figure out how to do it. I've tried:
py app.router.add_route("OPTIONS", "/{tail:.*}", handle_options)
app.router.add_route("OPTIONS", "*", handle_options)
app.router.add_route("OPTIONS", r"^/$", handle_options) but i either get ValueError: path should be started with / or be empty or it just doesnt respond to any request | 22:15:40 |
11 Jun 2024 |
Oleg A. | Can anybody explain what's going on with aiohttp resolver?
I see DefaultResolver can't be async, since aiodns_default is always False (even if aiodns exists)
Is it intented behaviour (reason?) or is it a bug? | 15:47:33 |
Oleg A. | Ah... found https://github.com/aio-libs/aiohttp/issues/2254
| 16:08:53 |
Oleg A. | Download Screenshot 2024-06-11 at 19.17.25.png | 16:17:43 |
Oleg A. | But still highly recommended | 16:17:50 |
Sam Bull | In reply to @sky:ccaa.party I'm trying to capture every single OPTIONS request onto a single handler, but I can't seem to figure out how to do it. I've tried:
py app.router.add_route("OPTIONS", "/{tail:.*}", handle_options)
app.router.add_route("OPTIONS", "*", handle_options)
app.router.add_route("OPTIONS", r"^/$", handle_options) but i either get ValueError: path should be started with / or be empty or it just doesnt respond to any request Seems to work for me: | 16:51:34 |
Sam Bull | In reply to @sky:ccaa.party I'm trying to capture every single OPTIONS request onto a single handler, but I can't seem to figure out how to do it. I've tried:
py app.router.add_route("OPTIONS", "/{tail:.*}", handle_options)
app.router.add_route("OPTIONS", "*", handle_options)
app.router.add_route("OPTIONS", r"^/$", handle_options) but i either get ValueError: path should be started with / or be empty or it just doesnt respond to any request * Seems to work for me:
from aiohttp import web
async def handle(request):
return web.Response(text="FOO")
app = web.Application()
app.router.add_route("OPTIONS", "/{foo:.*}", handle)
web.run_app(app)
| 16:51:47 |
Sam Bull | * Seems to work for me:
from aiohttp import web
async def handle(request):
return web.Response(text="FOO")
app = web.Application()
app.router.add_route("OPTIONS", "/{foo:.*}", handle)
web.run_app(app)
> curl -X OPTIONS 'http://localhost:8080/'
FOO⏎
> curl -X OPTIONS 'http://localhost:8080/bar'
FOO⏎
| 16:52:26 |
12 Jun 2024 |
| BoQsc (Feldwor) joined the room. | 17:04:17 |
BoQsc (Feldwor) | Hey everyone, does AIOHTTP support relative paths?
async def index(request):
return web.FileResponse("./index.html")
I tried this and it just says it does not find the file.
| 17:05:49 |
Sam Bull | It's using pathlib. I suggest being more precise by passing a pathlib.Path object instead. Then you can also play with that in your code to see what that path is looking at exactly (e.g. by printing Path.resolve()). | 18:26:15 |
13 Jun 2024 |
| Thomas Hardy joined the room. | 10:18:13 |
14 Jun 2024 |
| weallwegot joined the room. | 22:11:20 |
weallwegot | hi is there a way to import HTTPTooManyRequests ? im trying to use it as a criteria for retry. I tried to import it form aiohttp.web_exceptions but not able to, its saying no attribute named web_exceptions | 22:12:30 |
| weallwegot changed their display name from weallwegot (Tosin Sonuyi) to weallwegot. | 22:12:56 |
15 Jun 2024 |
Sam Bull | from aiohttp.web import HTTPTooManyRequests | 00:49:56 |
18 Jun 2024 |
| Wild rose joined the room. | 14:06:06 |
19 Jun 2024 |
| Wild rose changed their display name from memefi to war. | 05:24:29 |
20 Jun 2024 |
| Thomas Hardy left the room. | 09:33:28 |
| little_happy_cloud changed their profile picture. | 13:56:04 |