jeremyschulman / aio-ipfabric Goto Github PK
View Code? Open in Web Editor NEWPython 3.8 asycnio client for IP Fabric
License: Apache License 2.0
Python 3.8 asycnio client for IP Fabric
License: Apache License 2.0
Enhance the parse_filter
function to support the "ip" operator.
mixin_configs.py, mixin_inventory.py and mixin_diagrams.py are still present in the PyPI wheel.
Proof:
Install wheel and check -> old mixin_NAME at the root PRESENT
❯ pip install aio-ipfabric && cd ~/.pye/v/3.8/P/Versions/3.8/lib/python3.8/site-packages/aioipfabric
❯ ls
__init__.py aiofut.py base_client.py consts.py mixin_configs.py mixin_inventory.py
__pycache__ api.py client.py filters.py mixin_diagrams.py mixins
Download .tar.gz and check -> old mixin_NAME at the root NOT present
❯ cd ~/Downloads/aio-ipfabric-0.6.2
❯ ls aioipfabric
__init__.py aiofut.py api.py base_client.py client.py consts.py filters.py mixins
Presently the parse_filter function supports the question mark to be the "is empty" operator, for example:
"desc ? true"
Would be the filter of "Is the description column empty". This doe not read very well. Will add a new operator "exists" so that filters can be written
"desc exists true"
"desc exists false"
Which is more readable.
If you are using the client in a context manager, then the channel is closed. This issue fixes this bug for subsequent uses.
When trying to filter the fetch_devices with "hostname ~ 4200" we get an invalid response.
How to replicate:
import asyncio
from aioipfabric import IPFabricClient
loop = asyncio.get_event_loop()
ipf = IPFabricClient()
loop.run_until_complete(ipf.login())
hostname_filter = ipf.parse_filter("hostname ~ 4200")
test = loop.run_until_complete(ipf.fetch_devices(filters=hostname_filter))
ipf.logout()
This errors out:
422 Client Error: Unprocessable Entity for url: https://192.168.35.1/api/v1/tables/inventory/devices
For more information check: https://httpstatuses.com/422
This is because the filter looks like the following:
{'hostname': ['like', 4200]}
it should look like:
{'hostname': ['like', '4200']}
Hello Jeremy,
Could be nice to have the possibility to pass the httpx timeout as parameter:
https://github.com/jeremyschulman/aio-ipfabric/blob/main/aioipfabric/base_client.py#L188
aio-ipfabric/aioipfabric/api.py
Line 82 in 3306949
Today, there are several ways that data are get for their URIs / Columns parameters.
I propose that we create either under inventory.py or const.py a structure keeping together the URI and the columns associated (with several named variations possible).
We could/(should?) also include filter/reports into this structure.
The current function will have to be retrofitted.
This will allow potentially further fetch_function to be instantiated from one function.
The about description on Github (hence on Google) is: "Python 3.8 asycnio client for IP Fabric"
There is a typo, it should be "Python 3.8+ asyncio client for IP Fabric"
Hello,
In:
aio-ipfabric/aioipfabric/consts.py
Line 40 in 7e67667
we have API_VER = "/api/v1/"
whereas the current version of the API is v5. It is quite easy to override this in the code but perhaps it can be interesting to offer a way to setup this at class init ?
Julien
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.