!iWusolgBmhtSRRYDov:gitter.im

aio-libs

880 Members
https://github.com/aio-libs: a set of asyncio-based libraries built with high quality. There is a matrix space with more rooms at https://matrix.to/#/#aio-libs-space:matrix.org12 Servers

Load older messages


SenderMessageTime
24 May 2024
@sam:sambull.orgSam BullIt's a pretty small library, so I think the README is all of the documentation.16:15:09
@sam:sambull.orgSam BullThere's no client-side portion to the library.16:15:28
@sam:sambull.orgSam BullOr, if you mean create a (non-aiohttp) client that connects to it, then use common documentation online, such as MDN: https://developer.mozilla.org/docs/Web/API/Server-sent_events/Using_server-sent_events16:17:01
27 May 2024
@edw4rb-62b9c4256da037398499355a:gitter.imedw4rb (edw4rb)Hi Sam, thank you. The thing is that I have to connect to a SSE Server to get some information... We have our tech-stack in Python so that was why I was asking07:11:30
@edw4rb-62b9c4256da037398499355a:gitter.imedw4rb (edw4rb)Will try the MDN approach07:11:39
@edw4rb-62b9c4256da037398499355a:gitter.imedw4rb (edw4rb)Thank you again07:11:44
@sam:sambull.orgSam 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:sambull.orgSam 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-5448d6bcdb8155e6700cdc4d:gitter.im@jangrewe-5448d6bcdb8155e6700cdc4d:gitter.im left the room.23:10:56
1 Jun 2024
@leocx1000:matrix.orgLeonardo joined the room.12:26:01
9 Jun 2024
@ayleo:gitter.imLeo joined the room.20:46:58
@ayleo:gitter.imLeowasn't aware that gitter was chill like this20:48:19
10 Jun 2024
@sky:ccaa.partySky joined the room.21:31:50
@sky:ccaa.partySky 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:ccaa.partySky * 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
@t0rr:matrix.orgOleg 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
@t0rr:matrix.orgOleg A.Ah... found https://github.com/aio-libs/aiohttp/issues/2254 16:08:53
@t0rr:matrix.orgOleg A.Screenshot 2024-06-11 at 19.17.25.png
Download Screenshot 2024-06-11 at 19.17.25.png
16:17:43
@t0rr:matrix.orgOleg A.But still highly recommended16:17:50
@sam:sambull.orgSam 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:sambull.orgSam 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:sambull.orgSam 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-5aee0a3bd73408ce4f983d8f:gitter.imBoQsc (Feldwor) joined the room.17:04:17
@boqsc-5aee0a3bd73408ce4f983d8f:gitter.imBoQsc (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:sambull.orgSam BullIt'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
@hardy_tom:matrix.orgThomas Hardy joined the room.10:18:13
14 Jun 2024
@weallwegot-57258b11659847a7aff55d98:gitter.imweallwegot joined the room.22:11:20
@weallwegot-57258b11659847a7aff55d98:gitter.imweallwegot 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-57258b11659847a7aff55d98:gitter.imweallwegot changed their display name from weallwegot (Tosin Sonuyi) to weallwegot.22:12:56
15 Jun 2024
@sam:sambull.orgSam Bull from aiohttp.web import HTTPTooManyRequests 00:49:56

There are no newer messages yet.


Back to Room ListRoom Version: 6