-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
User class not working #6
Comments
What's your synapse server version? And please provide information from your api.cfg file as much as possible. |
The synapse version is 1.76.0, I see the package is only compatible with version <=1.70, but I'm only trying a basic function. Also I'm new to this, I didn't use a api.cfg file in the process. Thank you |
Btw, for a side question, I'm using ansible playbook to deploy the synapse, so the server lives in a docker container. And all my current admin api calls have to be made after I enter the docker environment. So is there really no way to use python to make admin api calls in my case? |
Usually, the compatible version means only (modification of) APIs introduced on or before that version are supported in this wrapper. So, it should be fine for your case.
If you are not using api.cfg, I assume you pass the host and account information to the class directly. Could you paste the arguments passed with redaction?
Admin APIs reside on |
Absolutely!
|
Does the problem happen all the time or just occasionally? Also, please try the following: import requests
r = requests.get(
"https://matrix.*******.org:8008/_synapse"
"/admin/v2/users?from=0&limit=100&guests="
"true&deactivated=false&dir=f",
headers={
"Authorization": f"Bearer {params['access_token']}",
"User-Agent": f"matrix-synpase-admin-python/test"
}
)
print(r.json()) Does it print out a list of users correctly? |
The program hangs, I have to kill it with keyboard. Anyway really appreciated! |
I have no idea for now, but I will try to deploy a Synapse instance through ansible to see what's the problem. |
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
The text was updated successfully, but these errors were encountered: