jeremyschulman / aio-ipfabric

Python 3.8 asycnio client for IP Fabric
Apache License 2.0
6 stars 3 forks source link

Parse Filter Bug #14

Closed minitriga closed 3 years ago

minitriga commented 3 years ago

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']}

jeremyschulman commented 3 years ago

Fixed in 6.0.2. https://pypi.org/project/aio-ipfabric/0.6.2/