diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2016-04-10 16:44:29 +0200 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2016-04-10 16:44:29 +0200 |
commit | 79db53f09f4abff5fa64a0f184ecbc223b9c0149 (patch) | |
tree | 9ae8ec39bdad97a277776eadbfc1473f04877403 | |
parent | 87a1f58d81e4bba73974f4dc6a3b74389f4930fe (diff) | |
download | psutil-79db53f09f4abff5fa64a0f184ecbc223b9c0149.tar.gz |
add doc
-rw-r--r-- | docs/index.rst | 69 | ||||
-rw-r--r-- | psutil/_pswindows.py | 2 |
2 files changed, 70 insertions, 1 deletions
diff --git a/docs/index.rst b/docs/index.rst index 90e2284d..618ab2d9 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1481,6 +1481,75 @@ Popen class 0 >>> +Windows services +================ + +.. note:: These APIs are Windows only. + +.. function:: win_service_iter() + + Return an iterator yielding a :class:`WindowsService` class instance for all + installed Windows services. + + .. versionadded:: 4.2.0 + Availability: Windows + +.. function:: win_service_get(name) + + Get a Windows service by name, returning a :class:`WindowsService` instance. + + .. versionadded:: 4.2.0 + Availability: Windows + +.. class:: WindowsService(name, display_name) + + Represents a Windows service with the given *name*. This class is returned + by :func:`win_service_iter` and :func:`win_service_get` functions and it is + not supposed to be instantiated directly. + + .. method:: name() + + The service name. The value is cached on instantiation. + + .. method:: display_name() + + The service display name. The value is cached on instantiation. + + .. method:: binpath() + + The fully qualified path to the service binary/exe file including + arguments. + + .. method:: username() + + The name of the user that owns the service. + + .. method:: startup_type() + + A string which can either be `"automatic"`, `"manual"` or `"disabled"`. + + .. method:: pid() + + The process PID, if any, else `None`. + + .. method:: status() + + Service status as a string, which may be either `"running"`, `"paused"`, + `"start_pending"`, `"pause_pending"`, `"continue_pending"`, + `"stop_pending"` or `"stopped"`. + + .. method:: description() + + Service long description. + + .. method:: as_dict() + + Utility method retrieving all the information above as a dictionary. + + .. versionadded:: 4.2.0 + Availability: Windows + + Constants ========= diff --git a/psutil/_pswindows.py b/psutil/_pswindows.py index 15713eee..92c333d8 100644 --- a/psutil/_pswindows.py +++ b/psutil/_pswindows.py @@ -335,7 +335,7 @@ class WindowsService(object): except WindowsError as err: if err.errno in ACCESS_DENIED_SET: raise AccessDenied(msg="service %r is not querable (not " - "enough privileges)" % self.name()) + "enough privileges)" % self._name) else: raise |