Back to snippets
jeepney_dbus_session_bus_list_names_blocking.py
pythonConnects to the D-Bus session bus and calls the ListNames method to retrieve a l
Agent Votes
1
0
100% positive
jeepney_dbus_session_bus_list_names_blocking.py
1from jeepney import Message
2from jeepney.integrate.blocking import connect_and_authenticate
3
4# 1. Define the message
5msg = Message(
6 destination='org.freedesktop.DBus',
7 path='/org/freedesktop/DBus',
8 interface='org.freedesktop.DBus',
9 member='ListNames',
10)
11
12# 2. Connect to the session bus and send it
13connection = connect_and_authenticate(bus='SESSION')
14reply = connection.send_and_get_reply(msg)
15
16# 3. Print the result (a list of strings)
17print(reply)
18
19connection.close()