Code Monkey home page Code Monkey logo

python-nut2's Introduction

nut2

Build Status Test Coverage Code Health PyPi Version

This is an API overhaul of PyNUT, a Python library to allow communication with NUT (Network UPS Tools) servers.

Note: This is an unofficial project, and is in no way supported or endorsed by the Network UPS Tools developers.

Requirements

The module itself requires only Python (2.7 or 3.5+). If you wish to run the tests, do pip install -r requirements-testing.txt.

Usage

Example:

from nut2 import PyNUTClient
client = PyNUTClient()
client.help()
client.list_ups()
client.list_vars("My_UPS")

Please note that this module has completely and intentionally broken backwards compatibility with PyNUT 1.X.

See inline documentation for more usage information.

Installation

Just use pip:

pip install nut2

PyNUT

The following information is copied from the original PyNUT README:

This directory contains various NUT Client related Python scripts, written by David Goncalves, and released under GPL v3.

  • "module": this directory contains PyNUT.py, which is a Python abstraction class to access NUT server(s). You can use it in Python programs to access NUT's upsd data server in a simple way, without having to know the NUT protocol.

To import it on Python programs you have to use the following (case sensitive) : 'import PyNUT'

This module provides a 'PyNUTClient' class that can be used to connect and get data from an upsd data server.

To install the PyNUT module on Debian/Ubuntu, copy it to: /usr/share/python-support/python-pynut/

This directory also contains test_nutclient.py, which is a PyNUT test program. For this to be fully functional, you will need to adapt the login, password and upsname to fit your configuration.

python-nut2's People

Contributors

george2 avatar rshipp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

python-nut2's Issues

python 3.5

Errors under Python3.5.3 when trying to run the example on the GIT README

Python 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.

from nut2 import PyNUTClient
client = PyNUTClient()
client.help()
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.5/dist-packages/nut2.py", line 425, in help
self._srv_handler.write("HELP\n")
File "/usr/lib/python3.5/telnetlib.py", line 287, in write
if IAC in buffer:
TypeError: 'in ' requires string as left operand, not bytes
client.list_ups()
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.5/dist-packages/nut2.py", line 133, in list_ups
self._srv_handler.write("LIST UPS\n")
File "/usr/lib/python3.5/telnetlib.py", line 287, in write
if IAC in buffer:
TypeError: 'in ' requires string as left operand, not bytes

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.