Code Monkey home page Code Monkey logo

pycentral's Issues

Insights from AIOps API does not work

Hello.

I cloned your repository and tried using that route and it does not return anything in the JSON.
I used the token for a organization and it does not list the insights...

It list APs, Switches, Gateways... But no Insights are returned.

No unit test cases for the Pycentral code

Hi,

As I was surfing through the code, I found that there are no unit test cases for the currently present code for Pycentral library. It will be helpful to have unit test cases in the repo before leveraging the library.

example AP rename code always terminates with an error

The example code always terminates with an error

AP_SETTINGS_CSV - ERROR - Failed to update ap settings for APs []

it looks like its just not checking for an empty array. Perhaps we could test for this condition.

unkown_aps = list(set(all_aps) - set(success_aps + failed_aps))
failed_aps = failed_aps + unkown_aps
print("")
LOGGER.error("Failed to update ap settings for APs %s" % failed_aps)

Timeout Handling

When performing API calls, I occasionally (but regularly and consistently) get client side timeout errors on the pycentral module which doesn't appear to be handling them well - usually a retry clears it right up, so it would probably be useful to to a better job of catching that particular exception or setting a retry count as well as a timeout value when creating the pycentral object, which can then be passed on to the requests module (it currently appears to be 60 seconds).

Problem with multiple ArubaCentralBase objects

I believe the use of a singleton C_DEFAULT_ARGS in pycentral.base_utils is causing an issue when using multiple API connections (e.g. when connecting multiple times with different credentials).

ArubaCentralBase.init makes a call to base_utils.parseInputArgs() to get a clean set of central_info parameters. Unfortunately, parseInputArgs() uses the same return dictionary for all calls. So, calling parseInputArgs() with different values affects all previous calls.

In parseInputArgs(), the line:

default_dict = C_DEFAULT_ARGS

can be replaced by:

default_dict = dict(C_DEFAULT_ARGS)

Thanks!

pip 21.3 just posted 2 days ago breaks pycentral

...
    from pycentral.base import ArubaCentralBase
  File "/home/wade/.local/lib/python3.8/site-packages/pycentral/base.py", line 26, in <module>
    from pycentral.base_utils import tokenLocalStoreUtil
  File "/home/wade/.local/lib/python3.8/site-packages/pycentral/base_utils.py", line 28, in <module>
    from pip._internal.utils.misc import get_installed_distributions
ImportError: cannot import name 'get_installed_distributions' from 'pip._internal.utils.misc

get_internal_distributions() was removed in 21.3 (posted 10/11/2021) the previous version 21.2.4 is fine.

PR with fix #10

FYI: can be worked around prior to the fix being published on pypi by specifying the older version pip install pip==21.2.4

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.