55* PyNUTError: Base class for custom exceptions.
66* PyNUTClient: Allows connecting to and communicating with PyNUT
77 servers.
8- """
98
9+ Copyright (C) 2013 george2
10+
11+ This program is free software: you can redistribute it and/or modify
12+ it under the terms of the GNU General Public License as published by
13+ the Free Software Foundation; either version 3 of the License, or
14+ (at your option) any later version.
1015
11- # Copyright (C) 2014 george2
12- #
13- # This program is free software: you can redistribute it and/or modify
14- # it under the terms of the GNU General Public License as published by
15- # the Free Software Foundation; either version 3 of the License, or
16- # (at your option) any later version.
17- #
18- # This program is distributed in the hope that it will be useful,
19- # but WITHOUT ANY WARRANTY; without even the implied warranty of
20- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21- # GNU General Public License for more details.
22- #
23- # You should have received a copy of the GNU General Public License
24- # along with this program. If not, see <http://www.gnu.org/licenses/>.
25-
26- # 2008-01-14 David Goncalves
27- # PyNUT is an abstraction class to access NUT (Network UPS
28- # Tools) server.
29- #
30- # 2008-06-09 David Goncalves
31- # Added 'GetRWVars' and 'SetRWVar' commands.
32- #
33- # 2009-02-19 David Goncalves
34- # Changed class PyNUT to PyNUTClient
35- #
36- # 2010-07-23 David Goncalves - Version 1.2
37- # Changed GetRWVars function that fails is the UPS is not
38- # providing such vars.
39- #
40- # 2011-07-05 René Martín Rodríguez <rmrodri@ull.es> - Version 1.2.1
41- # Added support for FSD, HELP and VER commands
42- #
43- # 2012-02-07 René Martín Rodríguez <rmrodri@ull.es> - Version 1.2.2
44- # Added support for LIST CLIENTS command
45- #
46- # 2014-06-02 george2 - Version 2.0.0
47- # Refactored the API, broke backwards compatibility.
48- #
16+ This program is distributed in the hope that it will be useful,
17+ but WITHOUT ANY WARRANTY; without even the implied warranty of
18+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+ GNU General Public License for more details.
20+
21+ You should have received a copy of the GNU General Public License
22+ along with this program. If not, see <http://www.gnu.org/licenses/>.
23+ """
4924
5025import telnetlib
5126import logging
5227
5328
54- __version__ = '2.0 .0'
29+ __version__ = '2.1 .0'
5530__all__ = ['PyNUTError' , 'PyNUTClient' ]
5631
5732logging .basicConfig (level = logging .WARNING , format = "[%(levelname)s] %(message)s" )
@@ -168,7 +143,7 @@ def description(self, ups):
168143 except IndexError :
169144 raise PyNUTError (result .replace ("\n " , "" ))
170145
171- def list_vars (self , ups = "" ):
146+ def list_vars (self , ups ):
172147 """Get all available vars from the specified UPS.
173148
174149 The result is a dictionary containing 'key->val' pairs of all
@@ -193,7 +168,7 @@ def list_vars(self, ups=""):
193168
194169 return ups_vars
195170
196- def list_commands (self , ups = "" ):
171+ def list_commands (self , ups ):
197172 """Get all available commands for the specified UPS.
198173
199174 The result is a dict object with command name as key and a description
@@ -261,7 +236,7 @@ def list_clients(self, ups=None):
261236
262237 return clients
263238
264- def list_rw_vars (self , ups = "" ):
239+ def list_rw_vars (self , ups ):
265240 """Get a list of all writable vars from the selected UPS.
266241
267242 The result is presented as a dictionary containing 'key->val'
@@ -349,7 +324,7 @@ def run_command(self, ups, command):
349324 if result != "OK\n " :
350325 raise PyNUTError (result .replace ("\n " , "" ))
351326
352- def fsd (self , ups = "" ):
327+ def fsd (self , ups ):
353328 """Send MASTER and FSD commands."""
354329 logging .debug ("MASTER called..." )
355330
@@ -364,7 +339,7 @@ def fsd(self, ups=""):
364339 if result != "OK FSD-SET\n " :
365340 raise PyNUTError (result .replace ("\n " , "" ))
366341
367- def num_logins (self , ups = "" ):
342+ def num_logins (self , ups ):
368343 """Send GET NUMLOGINS command to get the number of users logged
369344 into a given UPS.
370345 """
0 commit comments