Git Product home page Git Product logo

pyruckus's Introduction

pyruckus

A Python API which interacts with a Ruckus Unleashed device.

Important

This project is deprecated. It has been superseded by aioruckus, which uses HTTP and supports Python 3.11.

Setup

To install the pyruckus package:

pip3 install pyruckus

Usage

Each function is defined as an async function, so you will have to create an event loop instead of calling the functions directly in a shell.

from pyruckus import Ruckus
import asyncio

async def test_pyruckus():
    ruckus = Ruckus("<ruckus ip>", "<ruckus user>", "<ruckus password>")
    await ruckus.connect()

    ap_info = await ruckus.ap_info()
    mesh_info = await ruckus.mesh_info()
    system_info = await ruckus.system_info()
    config = await ruckus.config()
    clients = await ruckus.current_active_clients()
    wlan_info = await ruckus.wlan_info()

    ruckus.disconnect()

loop = asyncio.get_event_loop()
loop.run_until_complete(test_pyruckus())

pyruckus's People

Contributors

dependabot[bot] avatar gabe565 avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pyruckus's Issues

Release version 0.15 to PyPI

Home Assistant consumes pyruckus for it's integration to use Ruckus Unleashed devices. The latest version of Home Assistant (2022.7) that released on July 6, 2022 now fails to connect due to the underlying container now needing the fix that was put in place with commit 95d8ae0

I did see that you bumped the release version, but PyPi doesn't have the new version yet. I expect that it will need to be on PyPI before Home Assistant can pick up the new version.

Upgrade pexpect to avoid "'asyncio' has no attribute 'coroutine'" error

Pyruckus produces an error when executed on Python 3.11.3:

AttributeError: module 'asyncio' has no attribute 'coroutine

Context:

  • Home Assistant v2023.6.0 Docker image was recently published, which uses Python 3.11.3
  • The previous release worked, but the current release produces an error on startup

Log:

2023-06-07 22:58:16.021 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Ruckus WIFI Access Point for ruckus_unleashed
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/ruckus_unleashed/__init__.py", line 31, in async_setup_entry
    ruckus = await Ruckus.create(
             ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyruckus/__init__.py", line 44, in create
    await ruckus.connect()
  File "/usr/local/lib/python3.11/site-packages/pyruckus/__init__.py", line 50, in connect
    result = await ssh.login(
             ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pyruckus/RuckusSSH.py", line 48, in login
    i = await self.expect(login_regex_array, timeout=login_timeout, async_=True)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pexpect/spawnbase.py", line 340, in expect
    return self.expect_list(compiled_pattern_list,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pexpect/spawnbase.py", line 366, in expect_list
    from ._async import expect_async
  File "/usr/local/lib/python3.11/site-packages/pexpect/_async.py", line 6, in <module>
    @asyncio.coroutine
     ^^^^^^^^^^^^^^^^^
AttributeError: module 'asyncio' has no attribute 'coroutine'

I believe that this is caused by the pexpect library, which contains:

@asyncio.coroutine
def expect_async(expecter, timeout=None):

This may be fixed in the (unreleased) current master revision, but perhaps not. This issue appears to be related.

Doesn't work with systems that have deprecated ssh-rsa

This doesn't work on my system with a newer version of OpenSSH that has deprecated the ssh-rsa host key algorithm.

durrw@hahub ~ [1]> ssh 10.47.0.10
Unable to negotiate with 10.47.0.10 port 22: no matching host key type found. Their offer: ssh-rsa

This causes the code to raise a ConnectionError

  File "/srv/hass/lib/python3.9/site-packages/pyruckus/__init__.py", line 18, in __init__
    self.connect()
  File "/srv/hass/lib/python3.9/site-packages/pyruckus/__init__.py", line 27, in connect
    ssh.login(self.host, username=self.username, password=self.password, login_timeout=self.login_timeout)
  File "/srv/hass/lib/python3.9/site-packages/pyruckus/RuckusSSH.py", line 34, in login
    raise ConnectionError(CONNECT_ERROR_EOF)
ConnectionError: Could not establish connection to host

The option -oHostKeyAlgorithms=+ssh-rsa needs to be passed to the ssh command

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/codeql-analysis.yml
  • actions/checkout v3
  • github/codeql-action v2
  • github/codeql-action v2
  • github/codeql-action v2
.github/workflows/publish.yaml
  • actions/checkout v3
  • actions/setup-python v4
.github/workflows/tests.yaml
  • actions/checkout v3
  • actions/setup-python v4
pip_requirements
requirements.txt
  • pexpect >=4.0
  • python-slugify >=4.0.1
pip_setup
setup.py
  • pexpect >=4.0
  • python-slugify >=4.0.1
pre-commit
.pre-commit-config.yaml
  • pre-commit/pre-commit-hooks v4.4.0
  • asottile/pyupgrade v3.3.1
  • PyCQA/bandit 1.7.5
  • PyCQA/isort 5.12.0
  • pre-commit/mirrors-prettier v2.7.1
  • PyCQA/flake8 6.0.0
  • psf/black 23.3.0

  • Check this box to trigger a request for Renovate to run again on this repository

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.