jeremyschulman / aio-ipfabric

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

API version in ENV is not working with IPF recent releases #41

Closed jmanteau closed 1 year ago

jmanteau commented 1 year ago

Hello,

In: https://github.com/jeremyschulman/aio-ipfabric/blob/7e676674a274096b0ffa419ed549c766e85e3724/aioipfabric/consts.py#L40

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

jeremyschulman commented 1 year ago

@jmanteau - good idea. I will work on this update probably in the next week or so. We are also in the process of upgrading our IP Fabric systems to v5, so we need this too :-)

jeremyschulman commented 1 year ago

@jmanteau - I have not forgotten about this. I am just now working on the migration. If you would like to offer any suggestions/approaches please let me know. Otherwise my plan was to allow the Caller to provide a base_url value that would be used directly by the client - meaning that the Caller would include the /api/v5 path directly. Any objections with that approach?

jeremyschulman commented 1 year ago

@jmanteau - I've learned that as of IPF version 5, the API supports a non-version endpoint that will return the version.

In [7]: res = await ipf.api.get('/version')
​
In [8]: res.json()
Out[8]: {'apiVersion': 'v5.0', 'releaseVersion': '5.0.2+5'}

I will use this as part of the login() method so that the Caller is not required to provide the API substring in the constructor.

jmanteau commented 1 year ago

Hello, this is a very good idea !

jeremyschulman commented 1 year ago

@jmanteau - cool. I've got a PR that I am reviewing, and I should have this code merged and pushed to PyPI later today.