david-caro / python-foreman

Small low level python wrapper around Foreman API
GNU General Public License v2.0
57 stars 37 forks source link

Apiv2 #12

Closed xnaveira closed 9 years ago

xnaveira commented 10 years ago

I created a new branch to be able to use the v2 of the Foreman API

Unfortunately there is a parameter in the api (in method import_puppetclasses for the objects smart_proxies and environments) that is called 'except' and it triggers an exception when trying to generate the functions in python since it is a reserved word.

As a workaround I filtered it out but I'm sure that you'd fine a much better solution for that.

david-caro commented 10 years ago

Hey, I've been working a little with the apiv2 and I've created a new branch that adds support for it and for dynamically creating the api methods from the foreman instance (check the docs, you have to modify a foereman config file for that). Can you take a look and see if it works well for you?

To access the v2 methods you have to go using intermediary resources class, for example:

client.hosts.index, client.hosts.power, etc.

david-caro commented 9 years ago

Pushed the apiv2 version, let me know if you have any issues with it.