Giter Site home page Giter Site logo

knugihk / synapse-admin-api-python Goto Github PK

View Code? Open in Web Editor NEW
12.0 12.0 4.0 11.42 MB

A Python wrapper for Matrix Synapse admin API

License: MIT License

Python 98.72% Shell 1.28%
admin admin-api administration administration-tools management matrix matrix-synapse matrix-synapse-homeserver matrix-synapse-server python python-wrapper python3 synapse

synapse-admin-api-python's Introduction

synapse-admin-api-python's People

Contributors

emonical avatar knugihk avatar thebalaa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

synapse-admin-api-python's Issues

User class not working

Hello,

I tried the example in your doc to get information of all users, but it didn't work. The errors are as follows:

Traceback (most recent call last):
File "/home/admin/trial2.py", line 62, in
client.lists()
File "/home/admin/.local/lib/python3.9/site-packages/synapse_admin/user.py", line 117, in lists
resp = self.connection.request(
File "/home/admin/.local/lib/python3.9/site-packages/synapse_admin/base.py", line 626, in request
return request(url, **kwargs)
File "/home/admin/.local/lib/python3.9/site-packages/httpx/_client.py", line 1045, in get
return self.request(
File "/home/admin/.local/lib/python3.9/site-packages/httpx/_client.py", line 821, in request
return self.send(request, auth=auth, follow_redirects=follow_redirects)
File "/home/admin/.local/lib/python3.9/site-packages/httpx/_client.py", line 908, in send
response = self._send_handling_auth(
File "/home/admin/.local/lib/python3.9/site-packages/httpx/_client.py", line 936, in _send_handling_auth
response = self._send_handling_redirects(
File "/home/admin/.local/lib/python3.9/site-packages/httpx/_client.py", line 973, in _send_handling_redirects
response = self._send_single_request(request)
File "/home/admin/.local/lib/python3.9/site-packages/httpx/_client.py", line 1009, in _send_single_request
response = transport.handle_request(request)
File "/home/admin/.local/lib/python3.9/site-packages/httpx/_transports/default.py", line 218, in handle_request
resp = self._pool.handle_request(req)
File "/usr/lib/python3.9/contextlib.py", line 135, in exit
self.gen.throw(type, value, traceback)
File "/home/admin/.local/lib/python3.9/site-packages/httpx/_transports/default.py", line 77, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectError: [Errno -2] Name or service not known

"Iterable bodies must always iterate in bytestrings"

I just started testing your wrapper.

So far I can connect to our matrix server, get information (e.g. version, user list).
As soon as I try to send a body to the server (i.e. to create a user, send an announcement, ...), I get an error:

"Iterable bodies must always iterate in bytestrings"

Maybe I am just doing something wrong - is there any documentation or could you provide an example of user creation?

Thanks and best regards
Thomas

Running tests

When i was trying to run the tests to find if there were any flaky tests in the project I got the error saying that "no such file or directory: 'synapse_test/admin.token'". Just wondering where this file locates.

Avoid the anti flood

Hey, I've used your code and it worked very well, nice job !
In my opinion it would be useful to insert a command that avoids running into the antiflood of synapse
For example:
I wrote a script with which I generated about 60 rooms starting from a txt file that contained their names.
The server after the fifth / sixth room started giving some errors
To solve this, I inserted a 60-second sleep between the creation of one room and the next one

In my opinion it would be useful if this library will be able to disable the antiflood with a python command, or at least make it more flexible.

synapse >=1.92 does not return a python_version

using Management.version(), it should return a server_version and python_version.
But since synapse 1.94.0 it does not return a python_version in the JSON.

So your code produces an error.

I would also remove the python_version from the code. This may be backwards incompatible. You could also remove the python str from SynapseVersion (even more incompatible then 😆 ).

Best way would be to check if the server_version is < 1.94.0, and if yes, include python_version. if higher, skip it.

FYI: https://github.com/JOJ0/synadm

.. just had a look at current status of synapse admin tools (~medium impressive xD) and found a few, amongst which I like yours and https://github.com/JOJ0/synadm which already seems to have quite the endpoint coverage (haven't tried either yet). So this issue is just to let you know synadm is out there, maybe there's some synergy potential 🤠

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.