| Server IP : 112.74.42.100 / Your IP : 216.73.216.142 Web Server : nginx/1.20.2 System : Linux iZwz96lx4pjqiy84w4hni7Z 5.10.134-17.3.al8.x86_64 #1 SMP Thu Oct 31 14:29:57 CST 2024 x86_64 User : www ( 1000) PHP Version : 8.0.26 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/usr/share/doc/python3-slip-dbus/example/ |
Upload File : |
#!/usr/libexec/platform-python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import dbus
# ## FIND THE ACTUAL EXAMPLE CODE BELOW...
# try to find the module in the unpacked source tree
import sys
import os.path
import import_marker
# try to find the slip.dbus module
import imp
modfile = import_marker.__file__
path = os.path.dirname(modfile)
found = False
oldsyspath = sys.path
while not found and path and path != "/":
path = os.path.abspath(os.path.join(path, os.path.pardir))
try:
slipmod = imp.find_module("slip", [path] + sys.path)
if slipmod[1].startswith(path + "/"):
found = True
sys.path.insert(0, path)
import slip.dbus.service
except ImportError:
pass
if not found:
# fall back to system paths
sys.path = oldsyspath
import slip.dbus.service
# ## ...BELOW HERE:
from slip.dbus import polkit
class DBusProxy(object):
def __init__(self):
self.bus = dbus.SessionBus()
self.dbus_object = self.bus.get_object(
"org.fedoraproject.slip.example.mechanism",
"/org/fedoraproject/slip/example/object")
@polkit.enable_proxy
def read(self):
return self.dbus_object.read(
dbus_interface="org.fedoraproject.slip.example.mechanism")
@polkit.enable_proxy
def write(self, config_data):
return self.dbus_object.write(
config_data,
dbus_interface="org.fedoraproject.slip.example.mechanism")
example_object = DBusProxy()
config_data = example_object.read()
print("read config_data successfully:")
print(config_data)
print()
print()
print("attempting to write config data")
example_object.write(config_data + """
And a second more.""")
print("successfully wrote config data")