!JiiOHXrIUCtcOJsZCa:matrix.org

nio

343 Members
The nio matrix python library | Latest RC: 0.25.0rc3 Latest stable release 0.24.0 https://pypi.org/project/matrix-nio/ | Documentation: https://matrix-nio.readthedocs.io/en/stable/136 Servers

Load older messages


SenderMessageTime
12 Jul 2024
@nex:nexy7574.co.uknex (she/it) * By default, the max timeouts appears to be None, so it'll retry that request until it gets a response from the server, waiting exponentially longer each time there's a failed request too.00:20:15
@anton:rendezvous.anton.molyboha.meanton Ups... I'm sorry that was very sloppy of me. Yes, it's a raise not a throw, and I forgot that Python does not let you use anything you want as an exception. 07:05:31
@anton:rendezvous.anton.molyboha.meanton From reading the source code, looks like I was wrong about the SyncError.status_code too. It is actually a matrix status code, like "M_UNKNOWN" or "M_FORBIDDEN" and such. Or None if the response could not be parsed into json. 07:39:07
@fabian:alertrix.netFabian
In reply to @fabian:alertrix.net

I am trying to implement a custom store class but after registering a new user I always end up with

Traceback (most recent call last):
…
    self._handle_register(response)
…
    self.restore_login(response.user_id, response.device_id, response.access_token)
…
    self.load_store()
…
    self.olm = Olm(self.user_id, self.device_id, self.store)
…
    account = self.store.load_account()  # type: ignore
…
    return OlmAccount.from_pickle(account.account, self.pickle_key, account.shared)
…
    account = super().from_pickle(pickle, passphrase)
…
  File "[…]/lib64/python3.12/site-packages/olm/account.py", line 149, in from_pickle
    raise ValueError("Pickle can't be empty")
ValueError: Pickle can't be empty

I think I need to create a default value for the Accounts.account attribute in my Store(MatrixStore)s _get_account. How do I do that?

Solved it: I did not finish the database integration at that point, seems like the relevant data has been created somewhere in the nio code, but has not been saved to my database, which is why it could obviously not be read lateron
11:42:02
@anton:rendezvous.anton.molyboha.meanton
In reply to @anton:rendezvous.anton.molyboha.me

As far as I know, you should be able to just throw from inside on_sync_error:

def on_sync_error(response: SyncError):
    if response.status_code >= 500:
        throw response

but I don't know for sure, you need to try and check.

Another question I have is about the expression response.status_code >= 500. What will it do if the server is fully offline (does not accept tcp connections)? Will there be any status_code at all? Will it equal None and cause your code throw some other exception because you cannot compare None >= 500?

Thanks to nex's feedback, I think this should actually be:

class MatrixServerOffline(RuntimeError):
    pass

async def on_sync_error(error: matrix.SyncError):
    if error.transport_response.status >= 500:
        raise MatrixServerOffline()
12:34:16
@winduu:matrix.orgJosh

Hey Everyone!

I wanted to discuss the use of Access Tokens in query parameters and headers. 
Starting with v1.11, this method was deprecated for valid reasons (see the spec: https://spec.matrix.org/v1.11/client-server-api/#using-access-tokens). 
Unfortunately, Nio sends this token as a query parameter.

I found an existing issue from April 2020: Pass access_token as Authorization Bearer token? #118 which outlines the challenges involved. These challenges are indeed difficult, as addressing them might result in breaking changes to the API layer, which would be critical in my case.

Are there currently any efforts underway towards a change or solution on the Nio side? Given that many of us need to adhere to certain (security) policies, there's some pressure to comply with the spec as fast as possible. I wanted to check in before implementing something on our layer or creating a new Nio ticket for this.

Cheers!

13:00:52
14 Jul 2024
@anton:rendezvous.anton.molyboha.meanton
In reply to @winduu:matrix.org

Hey Everyone!

I wanted to discuss the use of Access Tokens in query parameters and headers. 
Starting with v1.11, this method was deprecated for valid reasons (see the spec: https://spec.matrix.org/v1.11/client-server-api/#using-access-tokens). 
Unfortunately, Nio sends this token as a query parameter.

I found an existing issue from April 2020: Pass access_token as Authorization Bearer token? #118 which outlines the challenges involved. These challenges are indeed difficult, as addressing them might result in breaking changes to the API layer, which would be critical in my case.

Are there currently any efforts underway towards a change or solution on the Nio side? Given that many of us need to adhere to certain (security) policies, there's some pressure to comply with the spec as fast as possible. I wanted to check in before implementing something on our layer or creating a new Nio ticket for this.

Cheers!

Could you elaborate, here or in that issue, in what way changes to the API layer would be critical in your case?
12:56:09
@anton:rendezvous.anton.molyboha.meanton

Some options I could imagine:

  1. A breaking change is introduced in version 0.26.0
  2. The API class is unchanged, but a new API2 class is created with the new interface; the rest of the code (slowly?) migrates to API2
  3. A breaking change is introduced in version 0.26.0, but instead of changing the API completely, the methods that currently return the 2-tuple (HTTP method, path) will now return a 3-tuple (HTTP method, path, HTTP headers). Such change is still breaking, but the migration is supposedly easier?

(Disclaimer: I don't have any authority in this project, just another user. I might have some free time over the next month-ish to work on this, though)

13:12:41
@justhm228:matrix.org@justhm228:matrix.org joined the room.18:21:58
@justhm228:matrix.org@justhm228:matrix.org left the room.18:37:44
@sfink:mozilla.orgsfink I'm still failing to read messages in an encrypted room. There are 2 of us in the room, call us users S and M. M is the script I'm working on. M can send an encrypted message, and S can read it. When S sends a message to the room, M gets WARNING:nio.crypto.log:Error decrypting megolm event, no session found with session id <blah> for room <blah>. 20:26:21
@sfink:mozilla.orgsfinkM seems to have an outbound session for that room with a different session id, which works, as I can tell because M can send messages and S can read them.20:27:12
@sfink:mozilla.orgsfinkwhat does M need to do in order to read S's messages?20:27:34
@sfink:mozilla.orgsfinkdoes it need to establish an "incoming" session somehow? How would it do that?20:27:50
@sfink:mozilla.orgsfink in my debugging, I've seen that share_group_session for that room and user has been called, but I think that's the outbound one. 20:28:51
@sfink:mozilla.orgsfink I would like to mimic matrix-commander -l, except that gives me a different error: Mismatch in keys payload of device <blah1> (<blah2>) of user <M> (<M>). 20:58:48
@nex:nexy7574.co.uknex (she/it)
In reply to @winduu:matrix.org

Hey Everyone!

I wanted to discuss the use of Access Tokens in query parameters and headers. 
Starting with v1.11, this method was deprecated for valid reasons (see the spec: https://spec.matrix.org/v1.11/client-server-api/#using-access-tokens). 
Unfortunately, Nio sends this token as a query parameter.

I found an existing issue from April 2020: Pass access_token as Authorization Bearer token? #118 which outlines the challenges involved. These challenges are indeed difficult, as addressing them might result in breaking changes to the API layer, which would be critical in my case.

Are there currently any efforts underway towards a change or solution on the Nio side? Given that many of us need to adhere to certain (security) policies, there's some pressure to comply with the spec as fast as possible. I wanted to check in before implementing something on our layer or creating a new Nio ticket for this.

Cheers!

It might be worth bumping the github issue :^)
21:17:00
16 Jul 2024
@winduu:matrix.orgJosh

Hey everyone,

Thanks for the responses! 😉

Sure:

Critical in the case that we are using Nio in the realms of a testing framework, synchronous (not using async functionality).

We mainly use the API directly to generate METHOD, PATH, and DATA, then create the requests and hand the response back over to Nio to do its thing (kind of like a man in the middle). Any substantial change to the API would break that, especially any change described in the 2020 ticket.

Regarding anton third point, returning METHOD, PATH, DATA, and HEADERS was something I was thinking about and definitely a preferred way of dealing with it. The amount of breaking changes and reimplementation is absolutely manageable, I'd say.

nex (she/it) - Roger, Roger. I'll summarize our conversation here and bump the 2020 ticket for further discussion.

14:44:55
18 Jul 2024
@nex:nexy7574.co.uknex (she/it) changed their profile picture.14:56:55
24 Jul 2024
@ifiguero:matrix.orgifiguero

Hello. I just upgrade the bot because reasons and now I get this

CyberBrain [WARNING]

21:04:07 | nio.client.async_clientTimed out, sleeping for 0s
21:04:23 | nio.client.async_clientTimed out, sleeping for 0s
21:04:39 | nio.client.async_clientTimed out, sleeping for 0s
21:04:55 | nio.client.async_clientTimed out, sleeping for 0s
21:05:11 | nio.client.async_clientTimed out, sleeping for 1s
21:05:28 | nio.client.async_clientTimed out, sleeping for 3s
21:05:47 | nio.client.async_clientTimed out, sleeping for 6s
21:06:09 | nio.client.async_clientTimed out, sleeping for 12s
21:06:37 | nio.client.async_clientTimed out, sleeping for 25s
21:07:18 | nio.client.async_clientTimed out, sleeping for 51s

When it connects

23:04:15
@ifiguero:matrix.orgifiguero* Hello. I just upgrade the bot because reasons and now I get this 21:04:07 | nio.client.async_clientTimed out, sleeping for 0s 21:04:23 | nio.client.async_clientTimed out, sleeping for 0s 21:04:39 | nio.client.async_clientTimed out, sleeping for 0s 21:04:55 | nio.client.async_clientTimed out, sleeping for 0s 21:05:11 | nio.client.async_clientTimed out, sleeping for 1s 21:05:28 | nio.client.async_clientTimed out, sleeping for 3s 21:05:47 | nio.client.async_clientTimed out, sleeping for 6s 21:06:09 | nio.client.async_clientTimed out, sleeping for 12s 21:06:37 | nio.client.async_clientTimed out, sleeping for 25s 21:07:18 | nio.client.async_clientTimed out, sleeping for 51s When it connects 23:04:30
@ifiguero:matrix.orgifiguero* Hello. I just upgrade the bot because reasons and now I get this #### [WARNING] ##### 21:04:07 | nio.client.async_client```Timed out, sleeping for 0s``` ##### 21:04:23 | nio.client.async_client```Timed out, sleeping for 0s``` ##### 21:04:39 | nio.client.async_client```Timed out, sleeping for 0s``` ##### 21:04:55 | nio.client.async_client```Timed out, sleeping for 0s``` ##### 21:05:11 | nio.client.async_client```Timed out, sleeping for 1s``` ##### 21:05:28 | nio.client.async_client```Timed out, sleeping for 3s``` ##### 21:05:47 | nio.client.async_client```Timed out, sleeping for 6s``` ##### 21:06:09 | nio.client.async_client```Timed out, sleeping for 12s``` ##### 21:06:37 | nio.client.async_client```Timed out, sleeping for 25s``` ##### 21:07:18 | nio.client.async_client```Timed out, sleeping for 51s``` When it connects 23:05:07
@ifiguero:matrix.orgifiguero I'm curious if that is some added verbosity or I'm being throttled or its something else. 23:06:11
26 Jul 2024
@astronaut778:matrix.orgmurlock1000Heyo, has anyone used sync_filter and have any examples of how to lets say sync only one room?13:53:14
@astronaut778:matrix.orgmurlock1000We have a bot system that has joined a few thousand rooms and we have noticed that the bot is missing the state of some of the rooms it is supposed to be in (client.rooms does not get populated with the room state). 13:54:24
@astronaut778:matrix.orgmurlock1000 * We have a bot system that has joined a few thousand rooms and we have noticed that the bot is missing the state of some of the rooms it is supposed to be in (AsyncClient.rooms does not get populated with the room state). 13:54:48
@astronaut778:matrix.orgmurlock1000 * We have a bot system that has joined a few thousand rooms and we have noticed that the bot is missing the state of some of the rooms it is supposed to be in (AsyncClient.rooms does not get populated with the room state). So we can't send messages to that room until the user of that rooms sends a message to the bot first13:56:20
@astronaut778:matrix.orgmurlock1000 * We have a bot system that has joined a few thousand rooms and we have noticed that the bot is missing the state of some of the rooms it is supposed to be in (AsyncClient.rooms does not get populated with the room state). So we can't send messages to that room until the user of that room sends a message to the bot first13:56:27
@astronaut778:matrix.orgmurlock1000Alsoo, has anyone figured out how to share historical room keys with users that the bot invites? The new rust-sdk backend that element pushed to all the clients recently broke the MSC3061: "Sharing room keys for past messages" Currently none of our users can view previous room messages before the invite13:59:38
@gergely:polonkai.eu@gergely:polonkai.eu left the room.15:20:10

There are no newer messages yet.


Back to Room ListRoom Version: 4